Search in sources :

Example 6 with RefreshToken

use of com.nimbusds.oauth2.sdk.token.RefreshToken in project pac4j by pac4j.

the class OidcProfileTests method testReadWriteObjectNullAccessToken.

/**
 * Test that serialization and deserialization of the OidcProfile work when the BearerAccessToken is null.
 */
@Test
public void testReadWriteObjectNullAccessToken() {
    OidcProfile profile = new OidcProfile();
    profile.setIdTokenString(ID_TOKEN);
    profile.setRefreshToken(new RefreshToken(REFRESH_TOKEN));
    byte[] result = SerializationUtils.serialize(profile);
    profile = SerializationUtils.deserialize(result);
    assertNull(profile.getAccessToken());
    assertEquals(profile.getIdTokenString(), ID_TOKEN);
    assertEquals(profile.getRefreshToken().getValue(), REFRESH_TOKEN);
}
Also used : RefreshToken(com.nimbusds.oauth2.sdk.token.RefreshToken) Test(org.junit.Test)

Aggregations

RefreshToken (com.nimbusds.oauth2.sdk.token.RefreshToken)6 Test (org.junit.Test)5 BearerAccessToken (com.nimbusds.oauth2.sdk.token.BearerAccessToken)3 JOSEException (com.nimbusds.jose.JOSEException)1 BadJOSEException (com.nimbusds.jose.proc.BadJOSEException)1 JWT (com.nimbusds.jwt.JWT)1 JWTClaimsSet (com.nimbusds.jwt.JWTClaimsSet)1 AuthorizationCode (com.nimbusds.oauth2.sdk.AuthorizationCode)1 ParseException (com.nimbusds.oauth2.sdk.ParseException)1 HTTPRequest (com.nimbusds.oauth2.sdk.http.HTTPRequest)1 HTTPResponse (com.nimbusds.oauth2.sdk.http.HTTPResponse)1 AccessToken (com.nimbusds.oauth2.sdk.token.AccessToken)1 IDTokenClaimsSet (com.nimbusds.openid.connect.sdk.claims.IDTokenClaimsSet)1 IOException (java.io.IOException)1 Map (java.util.Map)1 TechnicalException (org.pac4j.core.exception.TechnicalException)1