Skip to content

Commit

Permalink
ATO-595: Use JOURNEY_ID static member variable in TokenServiceTest
Browse files Browse the repository at this point in the history
  • Loading branch information
billrdunn committed May 9, 2024
1 parent 35a5f70 commit 57a3587
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class TokenServiceTest {
private static final Subject PUBLIC_SUBJECT = SubjectHelper.govUkSignInSubject();
private static final Subject INTERNAL_SUBJECT = SubjectHelper.govUkSignInSubject();
private static final Subject INTERNAL_PAIRWISE_SUBJECT = SubjectHelper.govUkSignInSubject();
private static final String JOURNEY_ID = "client-session-id";
private static final Scope SCOPES =
new Scope(OIDCScopeValue.OPENID, OIDCScopeValue.EMAIL, OIDCScopeValue.PHONE);
private static final String VOT = CredentialTrustLevel.MEDIUM_LEVEL.getValue();
Expand Down Expand Up @@ -165,7 +166,7 @@ void shouldGenerateTokenResponseWithRefreshToken()
null,
false,
JWSAlgorithm.ES256,
"client-session-id",
JOURNEY_ID,
VOT);

assertSuccessfulTokenResponse(tokenResponse);
Expand Down Expand Up @@ -239,7 +240,7 @@ void shouldOnlyIncludeIdentityClaimsInAccessTokenWhenRequested()
oidcClaimsRequest,
false,
JWSAlgorithm.ES256,
"client-session-id",
JOURNEY_ID,
VOT);

assertSuccessfulTokenResponse(tokenResponse);
Expand Down Expand Up @@ -312,7 +313,7 @@ void shouldGenerateTokenResponseWithoutRefreshTokenWhenOfflineAccessScopeIsMissi
null,
false,
JWSAlgorithm.ES256,
"client-session-id",
JOURNEY_ID,
VOT);

assertSuccessfulTokenResponse(tokenResponse);
Expand Down Expand Up @@ -347,7 +348,7 @@ void shouldNotIncludeInternalIdentifiersInTokens() throws ParseException, JOSEEx
null,
false,
JWSAlgorithm.ES256,
"client-session-id",
JOURNEY_ID,
VOT);

var parsedAccessToken =
Expand Down Expand Up @@ -559,7 +560,8 @@ private void assertSuccessfulTokenResponse(OIDCTokenResponse tokenResponse)
new AccessTokenStore(
tokenResponse.getOIDCTokens().getAccessToken().getValue(),
INTERNAL_SUBJECT.getValue(),
INTERNAL_PAIRWISE_SUBJECT.getValue());
INTERNAL_PAIRWISE_SUBJECT.getValue(),
JOURNEY_ID);
verify(redisConnectionService)
.saveWithExpiry(
accessTokenKey, objectMapper.writeValueAsString(accessTokenStore), 300L);
Expand Down Expand Up @@ -595,6 +597,6 @@ private void assertSuccessfulTokenResponse(OIDCTokenResponse tokenResponse)

assertThat(
tokenResponse.getOIDCTokens().getIDToken().getJWTClaimsSet().getStringClaim("sid"),
is("client-session-id"));
is(JOURNEY_ID));
}
}

0 comments on commit 57a3587

Please sign in to comment.