use of com.okta.oidc.net.response.TokenResponse in project okta-oidc-android by okta.
the class TokensTest method validateTokenInit_fromTokenResponse.
@Test
public void validateTokenInit_fromTokenResponse() {
TokenResponse tokenResponse = TestValues.getTokenResponse();
Tokens tokens = new Tokens(tokenResponse);
assertNotNull(tokens);
assertEquals(ACCESS_TOKEN, tokens.getAccessToken());
assertEquals(REFRESH_TOKEN, tokens.getRefreshToken());
assertEquals(ID_TOKEN, tokens.getIdToken());
assertEquals(VALID_EXPIRES_IN, tokens.getExpiresIn());
assertArrayEquals(VALID_SCOPES, tokens.getScope());
}
use of com.okta.oidc.net.response.TokenResponse in project okta-oidc-android by okta.
the class OktaStateTest method getTokenResponse.
@Test
public void getTokenResponse() throws OktaRepository.EncryptionException {
TokenResponse tokenResponse = TestValues.getTokenResponse();
mOktaState.save(tokenResponse);
TokenResponse expected = mOktaState.getTokenResponse();
assertNotNull(expected);
assertEquals(tokenResponse.persist(), expected.persist());
}
use of com.okta.oidc.net.response.TokenResponse in project okta-oidc-android by okta.
the class HttpClientImplTest method setUp.
@Before
public void setUp() throws Exception {
mEndPoint = new MockEndPoint();
String url = mEndPoint.getUrl();
OIDCConfig config = TestValues.getConfigWithUrl(url);
ProviderConfiguration providerConfiguration = TestValues.getProviderConfiguration(url);
TokenResponse tokenResponse = new Gson().fromJson(JsonStrings.TOKEN_RESPONSE, TokenResponse.class);
mHttpClient = new HttpClientImpl();
mRequest = HttpRequestBuilder.newAuthorizedRequest().uri(Uri.parse(mEndPoint.getUrl())).httpRequestMethod(ConnectionParameters.RequestMethod.POST).config(config).providerConfiguration(providerConfiguration).tokenResponse(tokenResponse).createRequest();
}
use of com.okta.oidc.net.response.TokenResponse in project okta-oidc-android by okta.
the class RefreshTokenRequestTest method executeRequestFailure.
@Test
public void executeRequestFailure() throws AuthorizationException {
mExpectedEx.expect(AuthorizationException.class);
mEndPoint.enqueueReturnInvalidClient();
TokenResponse response = mRequest.executeRequest(mHttpClient);
assertNull(response);
}
use of com.okta.oidc.net.response.TokenResponse in project okta-oidc-android by okta.
the class TokenRequestTest method executeRequestFailure.
@Test
public void executeRequestFailure() throws AuthorizationException {
mExpectedEx.expect(AuthorizationException.class);
mEndPoint.enqueueReturnInvalidClient();
TokenResponse response = mRequest.executeRequest(mHttpClient);
assertNull(response);
}
Aggregations