use of org.forgerock.openam.core.rest.authn.core.wrappers.CoreServicesWrapper in project OpenAM by OpenRock.
the class AuthIdHelperTest method setUp.
@BeforeMethod
public void setUp() {
coreServicesWrapper = mock(CoreServicesWrapper.class);
jwtBuilderFactory = mock(JwtBuilderFactory.class);
signingManager = mock(SigningManager.class);
authIdHelper = new AuthIdHelper(coreServicesWrapper, jwtBuilderFactory, signingManager);
jwsHeaderBuilder = mock(JwsHeaderBuilder.class);
claimsSetBuilder = mock(JwtClaimsSetBuilder.class);
JwtClaimsSet claimsSet = mock(JwtClaimsSet.class);
SignedJwtBuilderImpl signedJwtBuilder = mock(SignedJwtBuilderImpl.class);
given(jwtBuilderFactory.claims()).willReturn(claimsSetBuilder);
given(claimsSetBuilder.claim(anyString(), anyObject())).willReturn(claimsSetBuilder);
given(claimsSetBuilder.claims(anyMap())).willReturn(claimsSetBuilder);
given(claimsSetBuilder.build()).willReturn(claimsSet);
given(jwtBuilderFactory.jws(Matchers.<SigningHandler>anyObject())).willReturn(signedJwtBuilder);
given(signedJwtBuilder.headers()).willReturn(jwsHeaderBuilder);
given(jwsHeaderBuilder.alg(Matchers.<Algorithm>anyObject())).willReturn(jwsHeaderBuilder);
given(jwsHeaderBuilder.done()).willReturn(signedJwtBuilder);
given(signedJwtBuilder.claims(claimsSet)).willReturn(signedJwtBuilder);
given(signedJwtBuilder.build()).willReturn("JWT_STRING");
}
Aggregations