All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.aad.msal4j.RefreshTokenParameters Maven / Gradle / Ivy

Go to download

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

There is a newer version: 1.18.0
Show newest version
// Generated by delombok at Fri Jul 26 21:46:44 UTC 2024
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.microsoft.aad.msal4j;

import lombok.*;
import java.util.Map;
import java.util.Set;
import static com.microsoft.aad.msal4j.ParameterValidationUtils.validateNotBlank;
import static com.microsoft.aad.msal4j.ParameterValidationUtils.validateNotNull;

/**
 * Object containing parameters for refresh token request. Can be used as parameter to

 * {@link PublicClientApplication#acquireToken(RefreshTokenParameters)} or to

 * {@link ConfidentialClientApplication#acquireToken(RefreshTokenParameters)}

 * 

* RefreshTokenParameters should only be used for migration scenarios (when moving from ADAL to * MSAL). To acquire tokens silently, use {@link AbstractClientApplicationBase#acquireTokenSilently(SilentParameters)} */ public class RefreshTokenParameters implements IAcquireTokenParameters { /** * Scopes the application is requesting access to */ @NonNull private Set scopes; /** * Refresh token received from the STS */ @NonNull private String refreshToken; /** * Claims to be requested through the OIDC claims request parameter, allowing requests for standard and custom claims */ private ClaimsRequest claims; /** * Adds additional headers to the token request */ private Map extraHttpHeaders; /** * Adds additional parameters to the token request */ private Map extraQueryParameters; /** * Overrides the tenant value in the authority URL for this request */ private String tenant; private static RefreshTokenParametersBuilder builder() { return new RefreshTokenParametersBuilder(); } /** * Builder for {@link RefreshTokenParameters} * * @param scopes scopes application is requesting access to * @param refreshToken refresh token received form the STS * @return builder object that can be used to construct {@link RefreshTokenParameters} */ public static RefreshTokenParametersBuilder builder(Set scopes, String refreshToken) { validateNotBlank("refreshToken", refreshToken); return builder().scopes(scopes).refreshToken(refreshToken); } @java.lang.SuppressWarnings("all") public static class RefreshTokenParametersBuilder { @java.lang.SuppressWarnings("all") private Set scopes; @java.lang.SuppressWarnings("all") private String refreshToken; @java.lang.SuppressWarnings("all") private ClaimsRequest claims; @java.lang.SuppressWarnings("all") private Map extraHttpHeaders; @java.lang.SuppressWarnings("all") private Map extraQueryParameters; @java.lang.SuppressWarnings("all") private String tenant; @java.lang.SuppressWarnings("all") RefreshTokenParametersBuilder() { } @java.lang.SuppressWarnings("all") public RefreshTokenParametersBuilder scopes(final Set scopes) { this.scopes = scopes; return this; } @java.lang.SuppressWarnings("all") public RefreshTokenParametersBuilder refreshToken(final String refreshToken) { this.refreshToken = refreshToken; return this; } @java.lang.SuppressWarnings("all") public RefreshTokenParametersBuilder claims(final ClaimsRequest claims) { this.claims = claims; return this; } @java.lang.SuppressWarnings("all") public RefreshTokenParametersBuilder extraHttpHeaders(final Map extraHttpHeaders) { this.extraHttpHeaders = extraHttpHeaders; return this; } @java.lang.SuppressWarnings("all") public RefreshTokenParametersBuilder extraQueryParameters(final Map extraQueryParameters) { this.extraQueryParameters = extraQueryParameters; return this; } @java.lang.SuppressWarnings("all") public RefreshTokenParametersBuilder tenant(final String tenant) { this.tenant = tenant; return this; } @java.lang.SuppressWarnings("all") public RefreshTokenParameters build() { return new RefreshTokenParameters(scopes, refreshToken, claims, extraHttpHeaders, extraQueryParameters, tenant); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { return "RefreshTokenParameters.RefreshTokenParametersBuilder(scopes=" + this.scopes + ", refreshToken=" + this.refreshToken + ", claims=" + this.claims + ", extraHttpHeaders=" + this.extraHttpHeaders + ", extraQueryParameters=" + this.extraQueryParameters + ", tenant=" + this.tenant + ")"; } } /** * Scopes the application is requesting access to */ @NonNull @java.lang.SuppressWarnings("all") public Set scopes() { return this.scopes; } /** * Refresh token received from the STS */ @NonNull @java.lang.SuppressWarnings("all") public String refreshToken() { return this.refreshToken; } /** * Claims to be requested through the OIDC claims request parameter, allowing requests for standard and custom claims */ @java.lang.SuppressWarnings("all") public ClaimsRequest claims() { return this.claims; } /** * Adds additional headers to the token request */ @java.lang.SuppressWarnings("all") public Map extraHttpHeaders() { return this.extraHttpHeaders; } /** * Adds additional parameters to the token request */ @java.lang.SuppressWarnings("all") public Map extraQueryParameters() { return this.extraQueryParameters; } /** * Overrides the tenant value in the authority URL for this request */ @java.lang.SuppressWarnings("all") public String tenant() { return this.tenant; } @java.lang.SuppressWarnings("all") private RefreshTokenParameters(@NonNull final Set scopes, @NonNull final String refreshToken, final ClaimsRequest claims, final Map extraHttpHeaders, final Map extraQueryParameters, final String tenant) { if (scopes == null) { throw new java.lang.NullPointerException("scopes is marked @NonNull but is null"); } if (refreshToken == null) { throw new java.lang.NullPointerException("refreshToken is marked @NonNull but is null"); } this.scopes = scopes; this.refreshToken = refreshToken; this.claims = claims; this.extraHttpHeaders = extraHttpHeaders; this.extraQueryParameters = extraQueryParameters; this.tenant = tenant; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy