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

com.microsoft.bingads.OAuthDesktopMobileAuthCodeGrant Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 13.0.22.1
Show newest version
package com.microsoft.bingads;

import com.microsoft.bingads.internal.OAuthEndpointHelper;
import com.microsoft.bingads.internal.OAuthService;
import com.microsoft.bingads.internal.OAuthWithAuthorizationCode;

/**
 * Represents an OAuth authorization object implementing the authorization code grant flow for use in a desktop or mobile application. 
 */
public class OAuthDesktopMobileAuthCodeGrant extends OAuthWithAuthorizationCode {

    /**
     * Creates new instance of the class with the specified clientId and refreshToken.
     *
     * This class implements the authorization code grant flow for Managing User Authentication with OAuth
     * documented at http://go.microsoft.com/fwlink/?LinkID=511609.
     * This is a standard OAuth 2.0 flow and is defined in detail in the
     * Authorization Code Grant section of the OAuth 2.0 spec at
     * http://go.microsoft.com/fwlink/?LinkID=511609.
     * For more information about registering a Bing Ads application,
     * see http://go.microsoft.com/fwlink/?LinkID=511607
     *
     * @param clientId the client identifier corresponding to your registered application
     * @param refreshToken the refresh token that should be used to request an access token
     * 
     * @see https://tools.ietf.org/html/rfc6749#section-4.1
     */
    public OAuthDesktopMobileAuthCodeGrant(String clientId, String refreshToken) {
        this(clientId, refreshToken, ApiEnvironment.PRODUCTION);
    }
    
    
    /**
     * Creates new instance of the class with the specified clientId and refreshToken.
     *
     * This class implements the authorization code grant flow for Managing User Authentication with OAuth
     * documented at http://go.microsoft.com/fwlink/?LinkID=511609.
     * This is a standard OAuth 2.0 flow and is defined in detail in the
     * Authorization Code Grant section of the OAuth 2.0 spec at
     * http://go.microsoft.com/fwlink/?LinkID=511609.
     * For more information about registering a Bing Ads application,
     * see http://go.microsoft.com/fwlink/?LinkID=511607
     *
     * @param clientId the client identifier corresponding to your registered application
     * @param refreshToken the refresh token that should be used to request an access token
     * @param env Bing Ads Environment
     * 
     * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-15#section-3.1
     */
    public OAuthDesktopMobileAuthCodeGrant(String clientId, String refreshToken, ApiEnvironment env) {
        super(clientId, null, OAuthEndpointHelper.getOauthEndpoint(env, OAuthScope.MSADS_MANAGE).getDesktopRedirectUrl(), refreshToken, env, OAuthScope.MSADS_MANAGE);
    }

    /**
     * Creates new instance of the class that can be used in the
     * {@link AuthorizationData} object.
     *
     * See this page for additional information:
     * https://docs.microsoft.com/en-us/bingads/guides/authentication-oauth?view=bingads-12
     *
     * @param clientId the client identifier corresponding to your registered application
     * 
     * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-15#section-3.1
     */
    public OAuthDesktopMobileAuthCodeGrant(String clientId) {
        this(clientId, ApiEnvironment.PRODUCTION);
    }

    /**
     * Creates new instance of the class that can be used in the
     * {@link AuthorizationData} object.
     *
     * See this page for additional information:
     * https://docs.microsoft.com/en-us/bingads/guides/authentication-oauth?view=bingads-12
     *
     * @param clientId the client identifier corresponding to your registered application
     * @param env Bing Ads Environment
     * 
     * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-15#section-3.1
     */

    public OAuthDesktopMobileAuthCodeGrant(String clientId, ApiEnvironment env) {
        super(clientId, null, OAuthEndpointHelper.getOauthEndpoint(env, OAuthScope.MSADS_MANAGE).getDesktopRedirectUrl(), env, OAuthScope.MSADS_MANAGE);
    }
    
    /**
     * Creates new instance of the class that can be used in the
     * {@link AuthorizationData} object.
     *
     * See this page for additional information:
     * https://docs.microsoft.com/en-us/bingads/guides/authentication-oauth?view=bingads-12
     *
     * @param clientId the client identifier corresponding to your registered application
     * @param oauthTokens contains information about OAuth access tokens received from the Microsoft Account authorization service
     * 
     * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-15#section-3.1
     */
    public OAuthDesktopMobileAuthCodeGrant(String clientId, OAuthTokens oauthTokens) {
        this(clientId, oauthTokens, ApiEnvironment.PRODUCTION);
    }
    
    /**
     * Creates new instance of the class that can be used in the
     * {@link AuthorizationData} object.
     *
     * See this page for additional information:
     * https://docs.microsoft.com/en-us/bingads/guides/authentication-oauth?view=bingads-12
     *
     * @param clientId the client identifier corresponding to your registered application
     * @param oauthTokens contains information about OAuth access tokens received from the Microsoft Account authorization service
     * 
     * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-15#section-3.1
     */
    public OAuthDesktopMobileAuthCodeGrant(String clientId, OAuthTokens oauthTokens, ApiEnvironment env) {
        super(clientId, null, OAuthEndpointHelper.getOauthEndpoint(env, OAuthScope.MSADS_MANAGE).getDesktopRedirectUrl(), oauthTokens, env, OAuthScope.MSADS_MANAGE);
    }

    public OAuthDesktopMobileAuthCodeGrant(String clientId, OAuthService oAuthService, ApiEnvironment env, OAuthScope oAuthScope) {
        super(clientId, null, oAuthService.getRedirectUrl(oAuthScope), oAuthService, env, oAuthScope);
    }
    
    public OAuthDesktopMobileAuthCodeGrant(String clientId, String refreshToken, ApiEnvironment env, OAuthScope oAuthScope) {
        super(clientId, null, OAuthEndpointHelper.getOauthEndpoint(env, oAuthScope).getDesktopRedirectUrl(), refreshToken, env, oAuthScope);
    }
    
    public OAuthDesktopMobileAuthCodeGrant(String clientId, OAuthTokens oauthTokens, ApiEnvironment env, OAuthScope oAuthScope) {
        super(clientId, null, OAuthEndpointHelper.getOauthEndpoint(env, oAuthScope).getDesktopRedirectUrl(), oauthTokens, env, oAuthScope);
    }

    public OAuthDesktopMobileAuthCodeGrant(String clientId, ApiEnvironment env, OAuthScope oAuthScope) {
        super(clientId, null, OAuthEndpointHelper.getOauthEndpoint(env, oAuthScope).getDesktopRedirectUrl(), env, oAuthScope);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy