Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 5e1a438a authored by Youn Cadoret's avatar Youn Cadoret
Browse files

IUAINFRA-48 code review

parent f87de3fc
No related branches found
No related tags found
1 merge request!3Feature/iuainfra 31
Showing
with 28 additions and 33 deletions
Put here classes from adapter layer :
Data transformers, adapters, presenters or DAO. Abstraction of external libraries for
application or business use.
Web-services point, sockets, database connection and pool, GUI, file system, framework,
external libraries.
\ No newline at end of file
Put here classes from application layer :
Use cases. Business elements applied in an application context or scenario.
\ No newline at end of file
...@@ -15,13 +15,15 @@ import net.ihe.gazelle.sb.jwtstandardblock.business.jwt.JSONWebSignature; ...@@ -15,13 +15,15 @@ import net.ihe.gazelle.sb.jwtstandardblock.business.jwt.JSONWebSignature;
import net.ihe.gazelle.sb.jwtstandardblock.business.jwt.JSONWebToken; import net.ihe.gazelle.sb.jwtstandardblock.business.jwt.JSONWebToken;
import net.ihe.gazelle.sb.jwtstandardblock.business.jwt.JSONWebTokenClaimSet; import net.ihe.gazelle.sb.jwtstandardblock.business.jwt.JSONWebTokenClaimSet;
import javax.inject.Inject;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.Duration; import java.time.Duration;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.UUID; import java.util.UUID;
/**
* Class to generate the token
*/
public class TokenGenerator { public class TokenGenerator {
private static final String ALGORITHM = "HS256"; private static final String ALGORITHM = "HS256";
...@@ -31,7 +33,6 @@ public class TokenGenerator { ...@@ -31,7 +33,6 @@ public class TokenGenerator {
private AudienceSecretRetriever audienceSecretRetriever; private AudienceSecretRetriever audienceSecretRetriever;
@Inject
public void setAudienceSecretRetriever(AudienceSecretRetriever audienceSecretRetriever) { public void setAudienceSecretRetriever(AudienceSecretRetriever audienceSecretRetriever) {
this.audienceSecretRetriever = audienceSecretRetriever; this.audienceSecretRetriever = audienceSecretRetriever;
} }
......
package net.ihe.gazelle.app.accesstokenproviderapi.application; package net.ihe.gazelle.app.accesstokenproviderapi.application;
/**
* Class to manage token request exception
*/
public class TokenRequestException extends Exception { public class TokenRequestException extends Exception {
/** /**
......
package net.ihe.gazelle.app.accesstokenproviderapi.application.exception; package net.ihe.gazelle.app.accesstokenproviderapi.application.exception;
/**
* Class to manage unsupported algorithm exception
*/
public class UnsupportedAlgorithmException extends Exception { public class UnsupportedAlgorithmException extends Exception {
} }
package net.ihe.gazelle.app.accesstokenproviderapi.application.exception; package net.ihe.gazelle.app.accesstokenproviderapi.application.exception;
/**
* Class to manage unsupported token exception
*/
public class UnsupportedTokenTypeException extends Exception { public class UnsupportedTokenTypeException extends Exception {
} }
Put here classes from business layer :
Business model, rules and constraints. Always true. Independent from the application.
\ No newline at end of file
Put here test classes for adapter layer.
\ No newline at end of file
...@@ -5,6 +5,9 @@ import net.ihe.gazelle.app.audienceretriever.application.AudienceSecretRetriever ...@@ -5,6 +5,9 @@ import net.ihe.gazelle.app.audienceretriever.application.AudienceSecretRetriever
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/**
* Class to test the retriever of the audience secret
*/
public class AudienceSecretRetrieverTestImpl implements AudienceSecretRetriever { public class AudienceSecretRetrieverTestImpl implements AudienceSecretRetriever {
private Map<String, String> registry = new HashMap<>(); private Map<String, String> registry = new HashMap<>();
......
package net.ihe.gazelle.app.accesstokenproviderapi.application; package net.ihe.gazelle.app.accesstokenproviderapi.application;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
/**
* Class to test the soapui authorization server
*/
class DummyAuthzServerSoapuiTest { class DummyAuthzServerSoapuiTest {
private static final String SUBJECT = "aamrein"; private static final String SUBJECT = "aamrein";
...@@ -13,11 +18,11 @@ class DummyAuthzServerSoapuiTest { ...@@ -13,11 +18,11 @@ class DummyAuthzServerSoapuiTest {
*/ */
@Test @Test
public void getAccessTokenWithPathAudienceTest() { public void getAccessTokenWithPathAudienceTest() {
DummyAuthzServerSoapui dummyAuthzServer = new DummyAuthzServerSoapui("src/test/resources/audience.properties"); DummyAuthzServerSoapui dummyAuthzServer = new DummyAuthzServerSoapui();
dummyAuthzServer.setAudienceSecretRetriever((String audience) -> "myBeautifulKeyWhichIsAJWTSecretSoSecret"); dummyAuthzServer.setAudienceSecretRetriever((String audience) -> "myBeautifulKeyWhichIsAJWTSecretSoSecret");
assertNotNull(dummyAuthzServer.getAccessToken(SUBJECT, AUDIENCE, null, null)); assertNotNull(dummyAuthzServer.getAccessToken(SUBJECT, AUDIENCE, null, null), "check that the access token is not null");
} }
/** /**
...@@ -28,7 +33,7 @@ class DummyAuthzServerSoapuiTest { ...@@ -28,7 +33,7 @@ class DummyAuthzServerSoapuiTest {
DummyAuthzServerSoapui dummyAuthzServer = new DummyAuthzServerSoapui(); DummyAuthzServerSoapui dummyAuthzServer = new DummyAuthzServerSoapui();
dummyAuthzServer.setAudienceSecretRetriever((String audience) -> "myBeautifulKeyWhichIsAJWTSecretSoSecret"); dummyAuthzServer.setAudienceSecretRetriever((String audience) -> "myBeautifulKeyWhichIsAJWTSecretSoSecret");
assertNotNull(dummyAuthzServer.getAccessToken(SUBJECT, AUDIENCE, null, null)); assertNotNull(dummyAuthzServer.getAccessToken(SUBJECT, AUDIENCE, null, null), "check that the access token is not null");
} }
/** /**
...@@ -37,6 +42,6 @@ class DummyAuthzServerSoapuiTest { ...@@ -37,6 +42,6 @@ class DummyAuthzServerSoapuiTest {
@Test @Test
public void getAccessTokenWithBadPathAudienceTest() { public void getAccessTokenWithBadPathAudienceTest() {
DummyAuthzServerSoapui dummyAuthzServer = new DummyAuthzServerSoapui("test.properties"); DummyAuthzServerSoapui dummyAuthzServer = new DummyAuthzServerSoapui("test.properties");
assertNull(dummyAuthzServer.getAccessToken(SUBJECT, AUDIENCE, null, null)); assertNull(dummyAuthzServer.getAccessToken(SUBJECT, AUDIENCE, null, null), "check that the access token is null");
} }
} }
Put here test classes for application layer.
\ No newline at end of file
Put here test classes for business layer.
\ No newline at end of file
Put here your test resources.
\ No newline at end of file
Put here classes from adapter layer :
Data transformers, adapters, presenters or DAO. Abstraction of external libraries for
application or business use.
Web-services point, sockets, database connection and pool, GUI, file system, framework,
external libraries.
\ No newline at end of file
Put here classes from application layer :
Use cases. Business elements applied in an application context or scenario.
\ No newline at end of file
Put here classes from business layer :
Business model, rules and constraints. Always true. Independent from the application.
\ No newline at end of file
...@@ -5,6 +5,9 @@ import org.junit.jupiter.api.Test; ...@@ -5,6 +5,9 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
/**
* Class to test the retrieve of the audience secret
*/
class AudienceSecretRetrieverForSoapuiTest { class AudienceSecretRetrieverForSoapuiTest {
@Test @Test
......
Put here test classes for adapter layer.
\ No newline at end of file
Put here test classes for application layer.
\ No newline at end of file
Put here test classes for business layer.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment