com.google.api.ads.common.lib.auth
Class AuthorizationHeaderProvider

java.lang.Object
  extended by com.google.api.ads.common.lib.auth.AuthorizationHeaderProvider

public class AuthorizationHeaderProvider
extends Object

Authorization header provider that can delegate between different authentication mechanisms depending on the AdsSession.

Author:
Adam Rogal

Constructor Summary
AuthorizationHeaderProvider(OAuthAuthorizationHeaderProvider oAuthAuthorizationHeaderProvider, OAuth2AuthorizationHeaderProvider oAuth2AuthorizationHeaderProvider, com.google.api.ads.common.lib.conf.AdsLibConfiguration adsLibConfiguration, OAuth2Helper oAuth2Helper)
          Constructor.
 
Method Summary
 String getAuthorizationHeader(AdsSession adsSession, String endpointUrl)
          Gets a header value that can be set to the Authorization HTTP header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthorizationHeaderProvider

@Inject
public AuthorizationHeaderProvider(OAuthAuthorizationHeaderProvider oAuthAuthorizationHeaderProvider,
                                          OAuth2AuthorizationHeaderProvider oAuth2AuthorizationHeaderProvider,
                                          com.google.api.ads.common.lib.conf.AdsLibConfiguration adsLibConfiguration,
                                          OAuth2Helper oAuth2Helper)
Constructor.

Parameters:
oAuthAuthorizationHeaderProvider - the OAuth header provider
oAuth2AuthorizationHeaderProvider - the OAuth2 header provider
adsLibConfiguration - the library configuration
oAuth2Helper - the OAuth2 helper
Method Detail

getAuthorizationHeader

public String getAuthorizationHeader(AdsSession adsSession,
                                     @Nullable
                                     String endpointUrl)
                              throws AuthenticationException
Gets a header value that can be set to the Authorization HTTP header. The endpoint URL can be null if it's not needed for the authentication mechanism (i.e. OAuth2).

Parameters:
adsSession - the session to pull authentication information from
endpointUrl - the endpoint URL used for authentication mechanisms like OAuth.
Returns:
the authorization header
Throws:
AuthenticationException - if the authorization header could not be created
IllegalArgumentException - if no valid authentication information exists within the session.


Copyright © 2012. All Rights Reserved.