![JAR search and dependency download from the Maven repository](/logo.png)
com.microsoft.bingads.internal.OAuthAuthorization Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of microsoft.bingads Show documentation
Show all versions of microsoft.bingads Show documentation
The Bing Ads Java SDK is a library improving developer experience when working with the Bing Ads services by providing high-level access to features such as Bulk API, OAuth Authorization and SOAP API.
package com.microsoft.bingads.internal;
import com.microsoft.bingads.Authentication;
import com.microsoft.bingads.HeadersImpl;
import com.microsoft.bingads.OAuthDesktopMobileAuthCodeGrant;
import com.microsoft.bingads.OAuthDesktopMobileImplicitGrant;
import com.microsoft.bingads.OAuthTokens;
import com.microsoft.bingads.OAuthWebAuthCodeGrant;
import java.net.URL;
/**
* The abstract base class for all OAuth authentication classes.
*
*
* You can use this class to dynamically instantiate a derived OAuth authentication class at run time.
* This class cannot be instantiated, and instead you should use either {@link OAuthDesktopMobileAuthCodeGrant},
* {@link OAuthDesktopMobileImplicitGrant}, or {@link OAuthWebAuthCodeGrant}, which extend this class.
*
*
* @see OAuthDesktopMobileAuthCodeGrant
* @see OAuthDesktopMobileImplicitGrant
* @see OAuthWebAuthCodeGrant
*/
abstract class OAuthAuthorization extends Authentication {
/**
* Returns OAuth Authorization Endpoint that the user has to navigate to
* from the browser in order to get to the user consent page.
*
* @return OAuth Authorization Endpoint
*/
public abstract URL getAuthorizationEndpoint();
/**
* OAuth tokens received from live.com authorization service.
*
* Populated by derived classes {@link OAuthDesktopMobileImplicitGrant} and
* {@link OAuthWithAuthorizationCode}
*/
protected OAuthTokens oAuthTokens;
/**
* Gets information about OAuth access tokens received from the Microsoft Account authorization service.
*/
public OAuthTokens getOAuthTokens() {
return oAuthTokens;
}
/**
* Sets information about OAuth access tokens received from the Microsoft Account authorization service.
*/
protected void setOAuthTokens(OAuthTokens oAuthTokens) {
this.oAuthTokens = oAuthTokens;
}
public String getAuthenticationToken() {
return this.oAuthTokens.getAccessToken();
}
/**
* Adds the AuthenticationToken header element for the corresponding bulk file upload operation.
*
* @param headersImplementation the headers collection to which authentication requests should be added
*/
@Override
public void addHeaders(HeadersImpl headersImplementation) {
headersImplementation.addHeader(HttpHeaders.AUTHENTICATION_TOKEN, this.getOAuthTokens().getAccessToken());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy