Search in sources :

Example 1 with SignedJwtBuilderImpl

use of org.forgerock.json.jose.builders.SignedJwtBuilderImpl 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");
}
Also used : CoreServicesWrapper(org.forgerock.openam.core.rest.authn.core.wrappers.CoreServicesWrapper) JwtBuilderFactory(org.forgerock.json.jose.builders.JwtBuilderFactory) JwtClaimsSet(org.forgerock.json.jose.jwt.JwtClaimsSet) JwtClaimsSetBuilder(org.forgerock.json.jose.builders.JwtClaimsSetBuilder) SignedJwtBuilderImpl(org.forgerock.json.jose.builders.SignedJwtBuilderImpl) JwsHeaderBuilder(org.forgerock.json.jose.builders.JwsHeaderBuilder) SigningManager(org.forgerock.json.jose.jws.SigningManager) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

JwsHeaderBuilder (org.forgerock.json.jose.builders.JwsHeaderBuilder)1 JwtBuilderFactory (org.forgerock.json.jose.builders.JwtBuilderFactory)1 JwtClaimsSetBuilder (org.forgerock.json.jose.builders.JwtClaimsSetBuilder)1 SignedJwtBuilderImpl (org.forgerock.json.jose.builders.SignedJwtBuilderImpl)1 SigningManager (org.forgerock.json.jose.jws.SigningManager)1 JwtClaimsSet (org.forgerock.json.jose.jwt.JwtClaimsSet)1 CoreServicesWrapper (org.forgerock.openam.core.rest.authn.core.wrappers.CoreServicesWrapper)1 BeforeMethod (org.testng.annotations.BeforeMethod)1