use of org.gluu.oxauth.client.uma.UmaTokenService in project oxTrust by GluuFederation.
the class BaseApiTest method getAuthorizedRpt.
private void getAuthorizedRpt(String asUri, String ticket) {
try {
UmaMetadata umaMetadata = UmaClientFactory.instance().createMetadataService(asUri).getMetadata();
if (umaMetadata == null) {
throw new IllegalArgumentException(String.format("Failed to load valid UMA metadata configuration from: %s", asUri));
}
TokenRequest tokenRequest = getAuthorizationTokenRequest(umaMetadata);
UmaTokenService tokenService = UmaClientFactory.instance().createTokenService(umaMetadata);
UmaTokenResponse rptResponse = tokenService.requestJwtAuthorizationRpt(ClientAssertionType.JWT_BEARER.toString(), tokenRequest.getClientAssertion(), GrantType.OXAUTH_UMA_TICKET.getValue(), ticket, null, null, null, null, null);
if (rptResponse == null) {
throw new IllegalArgumentException("UMA RPT token response is invalid");
}
if (StringUtils.isBlank(rptResponse.getAccessToken())) {
throw new IllegalArgumentException("UMA RPT is invalid");
}
this.rpt = rptResponse.getAccessToken();
System.out.println("RPT IS:" + this.rpt);
} catch (Exception ex) {
throw new IllegalArgumentException(ex.getMessage(), ex);
}
}
Aggregations