Class BuildAccessTokenTest
- java.lang.Object
-
- org.opensaml.core.testing.OpenSAMLInitBaseTestCase
-
- net.shibboleth.idp.plugin.oidc.op.profile.impl.BaseOIDCResponseActionTest
-
- net.shibboleth.idp.plugin.oidc.op.oauth2.profile.impl.BuildAccessTokenTest
-
public class BuildAccessTokenTest extends BaseOIDCResponseActionTest
BuildAccessTokenunit test.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.shibboleth.idp.plugin.oidc.op.profile.impl.BaseOIDCResponseActionTest
BaseOIDCResponseActionTest.MockRevocationCache
-
-
Field Summary
Fields Modifier and Type Field Description private net.shibboleth.idp.plugin.oidc.op.oauth2.profile.impl.BuildAccessTokenactionAction to test.-
Fields inherited from class net.shibboleth.idp.plugin.oidc.op.profile.impl.BaseOIDCResponseActionTest
clientId, credentialEC256, credentialEC384, credentialEC521, credentialHMAC, credentialRSA, idGenerator, metadataCtx, profileRequestCtx, request, requestCtx, respCtx, rpCtx, subject
-
-
Constructor Summary
Constructors Constructor Description BuildAccessTokenTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidinitAction(String type, Function<ProfileRequestContext,BiFunction<ProfileRequestContext,Map<String,Object>,Map<String,Object>>> manipulationStrategy)Init action bean based on test.protected voidsetUp()Default setup.voidtestJWTSuccess()Basic success case, direct reuse of requested scope/audience.voidtestJWTSuccessWithCustomClaim()Basic success case, direct reuse of requested scope/audience.voidtestNoClientID()Test no client ID.voidtestOpaqueSuccess()Basic success case.voidtestOpaqueSuccessWithCustomClaims()Basic success case with custom claims.private voidverifyClaims(AccessTokenContext ctx, com.nimbusds.oauth2.sdk.Scope scope, Collection<String> audiences, Map<String,Object> customClaims)Verify access token's claims.protected voidverifyCustomClaims(com.nimbusds.jwt.JWTClaimsSet claimsSet, Map<String,Object> customClaims)-
Methods inherited from class net.shibboleth.idp.plugin.oidc.op.profile.impl.BaseOIDCResponseActionTest
addEntryToMap, getDataSealer, initializeDataSealer, setAuthenticationRequest, setIdTokenToResponseContext, setTokenRequest, setUserInfoRequest, setUserInfoResponseToResponseContext, signIdTokenInResponseContext, signUserInfoResponseInResponseContext
-
-
-
-
Method Detail
-
setUp
@BeforeMethod protected void setUp() throws Exception
Description copied from class:BaseOIDCResponseActionTestDefault setup.- Overrides:
setUpin classBaseOIDCResponseActionTest- Throws:
Exception
-
testNoClientID
public void testNoClientID() throws NoSuchAlgorithmException, ComponentInitializationExceptionTest no client ID.
-
testOpaqueSuccess
public void testOpaqueSuccess() throws ParseException, DataSealerException, ComponentInitializationException, NoSuchAlgorithmExceptionBasic success case.
-
testOpaqueSuccessWithCustomClaims
public void testOpaqueSuccessWithCustomClaims() throws ParseException, DataSealerException, ComponentInitializationException, NoSuchAlgorithmExceptionBasic success case with custom claims.
-
testJWTSuccess
public void testJWTSuccess() throws ParseException, ComponentInitializationException, NoSuchAlgorithmException, DataSealerExceptionBasic success case, direct reuse of requested scope/audience.
-
testJWTSuccessWithCustomClaim
public void testJWTSuccessWithCustomClaim() throws ParseException, ComponentInitializationException, NoSuchAlgorithmException, DataSealerExceptionBasic success case, direct reuse of requested scope/audience.
-
initAction
private void initAction(@Nullable @NotEmpty String type, @Nullable Function<ProfileRequestContext,BiFunction<ProfileRequestContext,Map<String,Object>,Map<String,Object>>> manipulationStrategy) throws ComponentInitializationException, NoSuchAlgorithmException
Init action bean based on test.- Parameters:
type- token type to usemanipulationStrategy- the manipulation strategy to use- Throws:
ComponentInitializationExceptionNoSuchAlgorithmException
-
verifyClaims
private void verifyClaims(@Nonnull AccessTokenContext ctx, @Nonnull com.nimbusds.oauth2.sdk.Scope scope, @Nonnull @NonnullElements Collection<String> audiences, Map<String,Object> customClaims) throws NoSuchAlgorithmException, ParseException, DataSealerException, ComponentInitializationExceptionVerify access token's claims.- Parameters:
ctx- access token contextscope- scope to check foraudiences- audiences to check forcustomClaims- custom claims to check for, may be null- Throws:
ComponentInitializationExceptionDataSealerExceptionParseExceptionNoSuchAlgorithmException
-
-