com.microsoft.aad.msal4j.AuthorizationCodeRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of msal4j Show documentation
Show all versions of msal4j Show documentation
Microsoft Authentication Library for Java gives you the ability to obtain tokens from Azure AD v2 (work and school
accounts, MSA) and Azure AD B2C, gaining access to Microsoft Cloud API and any other API secured by Microsoft
identities
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.microsoft.aad.msal4j;
import com.nimbusds.oauth2.sdk.AuthorizationCode;
import com.nimbusds.oauth2.sdk.AuthorizationCodeGrant;
import com.nimbusds.oauth2.sdk.AuthorizationGrant;
import com.nimbusds.oauth2.sdk.pkce.CodeVerifier;
class AuthorizationCodeRequest extends MsalRequest {
AuthorizationCodeRequest(AuthorizationCodeParameters parameters,
AbstractClientApplicationBase application,
RequestContext requestContext) {
super(application, createMsalGrant(parameters), requestContext);
}
private static AbstractMsalAuthorizationGrant createMsalGrant(AuthorizationCodeParameters parameters) {
AuthorizationGrant authorizationGrant;
if (parameters.codeVerifier() != null) {
authorizationGrant = new AuthorizationCodeGrant(
new AuthorizationCode(parameters.authorizationCode()),
parameters.redirectUri(),
new CodeVerifier(parameters.codeVerifier()));
} else {
authorizationGrant = new AuthorizationCodeGrant(
new AuthorizationCode(parameters.authorizationCode()), parameters.redirectUri());
}
return new OAuthAuthorizationGrant(authorizationGrant, parameters.scopes(), parameters.claims());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy