/** * Acquires an access token from the authority on behalf of a user. It * requires using a user token previously received. Uses certificate to * authenticate client. * * @param resource * Identifier of the target resource that is the recipient of the * requested token. * @param userAssertion * userAssertion to use as Authorization grant * @param credential * The certificate based client credential to use for token acquisition. * @param callback * optional callback object for non-blocking execution. * @return A {@link Future} object representing the * {@link AuthenticationResult} of the call. It contains Access * Token and the Access Token's expiration time. Refresh Token * property will be null for this overload. * @throws AuthenticationException {@link AuthenticationException} */ public Future<AuthenticationResult> acquireToken(final String resource, final UserAssertion userAssertion, final AsymmetricKeyCredential credential, final AuthenticationCallback callback) { this.validateOnBehalfOfRequestInput(resource, userAssertion, credential, true); ClientAssertion clientAssertion = JwtHelper .buildJwt(credential, this.authenticationAuthority.getSelfSignedJwtAudience()); final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(clientAssertion); return acquireTokenOnBehalfOf(resource, userAssertion, clientAuth, callback); }
/** * Acquires an access token from the authority on behalf of a user. It * requires using a user token previously received. Uses certificate to * authenticate client. * * @param resource * Identifier of the target resource that is the recipient of the * requested token. * @param userAssertion * userAssertion to use as Authorization grant * @param credential * The certificate based client credential to use for token acquisition. * @param callback * optional callback object for non-blocking execution. * @return A {@link Future} object representing the * {@link AuthenticationResult} of the call. It contains Access * Token and the Access Token's expiration time. Refresh Token * property will be null for this overload. * @throws AuthenticationException {@link AuthenticationException} */ public Future<AuthenticationResult> acquireToken(final String resource, final UserAssertion userAssertion, final AsymmetricKeyCredential credential, final AuthenticationCallback callback) { this.validateOnBehalfOfRequestInput(resource, userAssertion, credential, true); ClientAssertion clientAssertion = JwtHelper .buildJwt(credential, this.authenticationAuthority.getSelfSignedJwtAudience()); final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(clientAssertion); return acquireTokenOnBehalfOf(resource, userAssertion, clientAuth, callback); }
/** * Acquires an access token from the authority on behalf of a user. It * requires using a user token previously received. * * @param resource * Identifier of the target resource that is the recipient of the * requested token. * @param userAssertion * userAssertion to use as Authorization grant * @param credential * The client credential to use for token acquisition. * @param callback * optional callback object for non-blocking execution. * @return A {@link Future} object representing the * {@link AuthenticationResult} of the call. It contains Access * Token and the Access Token's expiration time. Refresh Token * property will be null for this overload. * @throws AuthenticationException {@link AuthenticationException} */ public Future<AuthenticationResult> acquireToken(final String resource, final UserAssertion userAssertion, final ClientCredential credential, final AuthenticationCallback callback) { this.validateOnBehalfOfRequestInput(resource, userAssertion, credential, true); final ClientAuthentication clientAuth = new ClientSecretPost( new ClientID(credential.getClientId()), new Secret( credential.getClientSecret())); return acquireTokenOnBehalfOf(resource, userAssertion, clientAuth, callback); }
/** * Acquires an access token from the authority on behalf of a user. It * requires using a user token previously received. * * @param resource * Identifier of the target resource that is the recipient of the * requested token. * @param userAssertion * userAssertion to use as Authorization grant * @param credential * The client credential to use for token acquisition. * @param callback * optional callback object for non-blocking execution. * @return A {@link Future} object representing the * {@link AuthenticationResult} of the call. It contains Access * Token and the Access Token's expiration time. Refresh Token * property will be null for this overload. * @throws AuthenticationException {@link AuthenticationException} */ public Future<AuthenticationResult> acquireToken(final String resource, final UserAssertion userAssertion, final ClientCredential credential, final AuthenticationCallback callback) { this.validateOnBehalfOfRequestInput(resource, userAssertion, credential, true); final ClientAuthentication clientAuth = new ClientSecretPost( new ClientID(credential.getClientId()), new Secret( credential.getClientSecret())); return acquireTokenOnBehalfOf(resource, userAssertion, clientAuth, callback); }