diff --git a/access-token-provider-api/src/main/java/net/ihe/gazelle/app/accesstokenproviderapi/application/TokenGenerator.java b/access-token-provider-api/src/main/java/net/ihe/gazelle/app/accesstokenproviderapi/application/TokenGenerator.java index de715c8cab2d25716f07fab6e819b493ef39bdf2..0e52ad2381ece3743304550087c38c97e4b38be5 100644 --- a/access-token-provider-api/src/main/java/net/ihe/gazelle/app/accesstokenproviderapi/application/TokenGenerator.java +++ b/access-token-provider-api/src/main/java/net/ihe/gazelle/app/accesstokenproviderapi/application/TokenGenerator.java @@ -33,10 +33,23 @@ public class TokenGenerator { private AudienceSecretRetriever audienceSecretRetriever; + /** + * Set an audience secret + * + * @param audienceSecretRetriever AudienceSecretRetriever element + */ public void setAudienceSecretRetriever(AudienceSecretRetriever audienceSecretRetriever) { this.audienceSecretRetriever = audienceSecretRetriever; } + /** + * Encode the IUA token + * + * @param accessTokenRequest AccessTokenRequest element + * @return The EncodedIUAToken + * @throws EncodingException + * @throws TokenRequestException + */ public EncodedIUAToken generateAccessToken(AccessTokenRequest accessTokenRequest) throws EncodingException, TokenRequestException { if (accessTokenRequest.getSignature() == null) { throw new TokenRequestException("Missing signature information"); diff --git a/access-token-provider-api/src/main/java/net/ihe/gazelle/app/accesstokenproviderapi/application/exception/UnsupportedAlgorithmException.java b/access-token-provider-api/src/main/java/net/ihe/gazelle/app/accesstokenproviderapi/application/exception/UnsupportedAlgorithmException.java index 078073b5cbc40046e0a9a44d6ff7fe23da43b94c..789d9bcce78ad572d22700014805356dfb4daf1f 100644 --- a/access-token-provider-api/src/main/java/net/ihe/gazelle/app/accesstokenproviderapi/application/exception/UnsupportedAlgorithmException.java +++ b/access-token-provider-api/src/main/java/net/ihe/gazelle/app/accesstokenproviderapi/application/exception/UnsupportedAlgorithmException.java @@ -5,5 +5,57 @@ package net.ihe.gazelle.app.accesstokenproviderapi.application.exception; */ public class UnsupportedAlgorithmException extends Exception { + /** + * Constructs a new exception with null as its detail message. The cause is not initialized, and may subsequently be initialized by a call to + * {@link Throwable#initCause(Throwable)}. + */ + public UnsupportedAlgorithmException() { + } + /** + * Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to + * {@link Throwable#initCause(Throwable)}. + * + * @param message the detail message. Can be retrieved by a later call of {@link Throwable#getMessage()} method. + */ + public UnsupportedAlgorithmException(String message) { + super(message); + } + + /** + * Constructs a new exception with the specified detail message and cause. Note that the detail/TransactionRecordingDAO message associated with + * cause is not automatically incorporated in this exception's detail message. + * + * @param message the detail message. Can be retrieved by a later call of {@link Throwable#getMessage()} method. + * @param cause the cause. Can be retrieved by a lter call to {@link Throwable#getCause()}. A null value is permitted, and indicates that the + * cause is nonexistent or unknown. + */ + public UnsupportedAlgorithmException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new exception with the specified detail message, cause, suppression enabled or disabled, and writable stack trace enabled or + * disabled. + * + * @param cause the cause. Can be retrieved by a lter call to {@link Throwable#getCause()}. A null value is permitted, and indicates + * that the cause is nonexistent or unknown. + */ + public UnsupportedAlgorithmException(Throwable cause) { + super(cause); + } + + /** + * Constructs a new exception with the specified detail message, cause, suppression enabled or disabled, and writable stack trace enabled or + * disabled. + * + * @param message the detail message. Can be retrieved by a later call of {@link Throwable#getMessage()} method. + * @param cause the cause. Can be retrieved by a lter call to {@link Throwable#getCause()}. A null value is permitted, and indicates + * that the cause is nonexistent or unknown. + * @param enableSuppression whether or not suppression is enabled or disabled + * @param writableStackTrace whether or not the stack trace should be writable + */ + public UnsupportedAlgorithmException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } } diff --git a/access-token-provider-api/src/main/java/net/ihe/gazelle/app/accesstokenproviderapi/application/exception/UnsupportedTokenTypeException.java b/access-token-provider-api/src/main/java/net/ihe/gazelle/app/accesstokenproviderapi/application/exception/UnsupportedTokenTypeException.java index 829eb6d52890330adba910c1fe63dac9fced6b98..adea3058e9fcdbebc865d5b991eefad5cfcaaa7c 100644 --- a/access-token-provider-api/src/main/java/net/ihe/gazelle/app/accesstokenproviderapi/application/exception/UnsupportedTokenTypeException.java +++ b/access-token-provider-api/src/main/java/net/ihe/gazelle/app/accesstokenproviderapi/application/exception/UnsupportedTokenTypeException.java @@ -4,4 +4,59 @@ package net.ihe.gazelle.app.accesstokenproviderapi.application.exception; * Class to manage unsupported token exception */ public class UnsupportedTokenTypeException extends Exception { + + /** + * Constructs a new exception with null as its detail message. The cause is not initialized, and may subsequently be initialized by a call to + * {@link Throwable#initCause(Throwable)}. + */ + public UnsupportedTokenTypeException() { + } + + /** + * Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to + * {@link Throwable#initCause(Throwable)}. + * + * @param message the detail message. Can be retrieved by a later call of {@link Throwable#getMessage()} method. + */ + public UnsupportedTokenTypeException(String message) { + super(message); + } + + /** + * Constructs a new exception with the specified detail message and cause. Note that the detail/TransactionRecordingDAO message associated with + * cause is not automatically incorporated in this exception's detail message. + * + * @param message the detail message. Can be retrieved by a later call of {@link Throwable#getMessage()} method. + * @param cause the cause. Can be retrieved by a lter call to {@link Throwable#getCause()}. A null value is permitted, and indicates that the + * cause is nonexistent or unknown. + */ + public UnsupportedTokenTypeException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new exception with the specified detail message, cause, suppression enabled or disabled, and writable stack trace enabled or + * disabled. + * + * @param cause the cause. Can be retrieved by a lter call to {@link Throwable#getCause()}. A null value is permitted, and indicates + * that the cause is nonexistent or unknown. + */ + public UnsupportedTokenTypeException(Throwable cause) { + super(cause); + } + + /** + * Constructs a new exception with the specified detail message, cause, suppression enabled or disabled, and writable stack trace enabled or + * disabled. + * + * @param message the detail message. Can be retrieved by a later call of {@link Throwable#getMessage()} method. + * @param cause the cause. Can be retrieved by a lter call to {@link Throwable#getCause()}. A null value is permitted, and indicates + * that the cause is nonexistent or unknown. + * @param enableSuppression whether or not suppression is enabled or disabled + * @param writableStackTrace whether or not the stack trace should be writable + */ + public UnsupportedTokenTypeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } + } diff --git a/access-token-provider-api/src/test/java/net/ihe/gazelle/app/accesstokenproviderapi/application/AudienceSecretRetrieverTestImpl.java b/access-token-provider-api/src/test/java/net/ihe/gazelle/app/accesstokenproviderapi/application/AudienceSecretRetrieverTestImpl.java index 30d64acf5434d75e08c05a022231d694e4ca5389..f3b95e3d214ef601d1ac4a515ef2160e70f40859 100644 --- a/access-token-provider-api/src/test/java/net/ihe/gazelle/app/accesstokenproviderapi/application/AudienceSecretRetrieverTestImpl.java +++ b/access-token-provider-api/src/test/java/net/ihe/gazelle/app/accesstokenproviderapi/application/AudienceSecretRetrieverTestImpl.java @@ -12,9 +12,18 @@ public class AudienceSecretRetrieverTestImpl implements AudienceSecretRetriever private Map<String, String> registry = new HashMap<>(); + /** + * Constructor + */ public AudienceSecretRetrieverTestImpl() { } + /** + * Add a new audience + * + * @param audience String element + * @param secret String element + */ public void addAudience(String audience, String secret){ registry.put(audience, secret); } diff --git a/audience-retriever/src/test/java/net/ihe/gazelle/app/audienceretriever/adapter/AudienceSecretRetrieverForSoapuiTest.java b/audience-retriever/src/test/java/net/ihe/gazelle/app/audienceretriever/adapter/AudienceSecretRetrieverForSoapuiTest.java index 568dd135198c4959f83c9f093e36f59738f0eb73..07611a2b66fe9fb2ea67971e771c09ff7d3065b7 100644 --- a/audience-retriever/src/test/java/net/ihe/gazelle/app/audienceretriever/adapter/AudienceSecretRetrieverForSoapuiTest.java +++ b/audience-retriever/src/test/java/net/ihe/gazelle/app/audienceretriever/adapter/AudienceSecretRetrieverForSoapuiTest.java @@ -10,7 +10,9 @@ import static org.junit.jupiter.api.Assertions.assertNull; */ class AudienceSecretRetrieverForSoapuiTest { - + /** + * Test the property set in the retriever secret audience method + */ @Test void retrieveSecretForAudienceWithPropertiesPathTest() { AudienceSecretRetrieverForSoapui audienceSecretRetrieverForSoapui = new AudienceSecretRetrieverForSoapui("/opt/simulators/audience.properties");