/** * 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 security token from the authority. * * @param resource * Identifier of the target resource that is the recipient of the * requested token. * @param clientAssertion * The client assertion to use for client authentication. * @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. */ public Future<AuthenticationResult> acquireToken(final String resource, final ClientAssertion clientAssertion, final AuthenticationCallback callback) { this.validateInput(resource, clientAssertion, true); final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(clientAssertion); final AdalOAuthAuthorizationGrant authGrant = new AdalOAuthAuthorizationGrant( new ClientCredentialsGrant(), resource); return this.acquireToken(authGrant, clientAuth, callback); }
/** * Acquires security token from the authority. * * @param resource * Identifier of the target resource that is the recipient of the * requested token. * @param clientAssertion * The client assertion to use for client authentication. * @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. */ public Future<AuthenticationResult> acquireToken(final String resource, final ClientAssertion clientAssertion, final AuthenticationCallback callback) { this.validateInput(resource, clientAssertion, true); final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(clientAssertion); final AdalOAuthAuthorizationGrant authGrant = new AdalOAuthAuthorizationGrant( new ClientCredentialsGrant(), resource); return this.acquireToken(authGrant, clientAuth, callback); }
/** * Acquires security token from the authority. * * @param resource * Identifier of the target resource that is the recipient of the * requested token. * @param credential * The client assertion 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. */ public Future<AuthenticationResult> acquireToken(final String resource, final ClientAssertion credential, final AuthenticationCallback callback) { this.validateInput(resource, credential, true); final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(credential); final AdalAuthorizatonGrant authGrant = new AdalAuthorizatonGrant( new ClientCredentialsGrant(), resource); return this.acquireToken(authGrant, clientAuth, callback); }
final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(clientAssertion); final AdalOAuthAuthorizationGrant authGrant = new AdalOAuthAuthorizationGrant( new AuthorizationCodeGrant(new AuthorizationCode(
final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(credential); final AdalAuthorizatonGrant authGrant = new AdalAuthorizatonGrant( new AuthorizationCodeGrant(new AuthorizationCode(
final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(clientAssertion); final AdalOAuthAuthorizationGrant authGrant = new AdalOAuthAuthorizationGrant( new AuthorizationCodeGrant(new AuthorizationCode(
this.validateRefreshTokenRequestInput(refreshToken, clientId, clientAssertion); final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(clientAssertion); final AdalOAuthAuthorizationGrant authGrant = new AdalOAuthAuthorizationGrant( new RefreshTokenGrant(new RefreshToken(refreshToken)), resource);
this.validateRefreshTokenRequestInput(refreshToken, clientId, clientAssertion); final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(clientAssertion); final AdalOAuthAuthorizationGrant authGrant = new AdalOAuthAuthorizationGrant( new RefreshTokenGrant(new RefreshToken(refreshToken)), resource);
this.validateRefreshTokenRequestInput(refreshToken, clientId, credential); final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(credential); final AdalAuthorizatonGrant authGrant = new AdalAuthorizatonGrant( new RefreshTokenGrant(new RefreshToken(refreshToken)), resource);