com.google.api.ads.dfa.lib.auth
Interface LoginTokensHelper


public interface LoginTokensHelper

Helper class for LoginTokens.

Author:
Adam Rogal

Method Summary
 Object authenticate(String username, String password, Class<?> loginClass, Object loginService)
          Authenticates against the DFA API.
 Class<?> getLoginClass(String stubPackage)
          Retrieves the Class object representing the login service.
 Object getLoginService(DfaSession session, Class<?> loginClass)
          Returns a DfaServiceClient wrapping the login service.
 Class<?> getUserProfileClass(String stubPackage)
          Retrieves the Class object representing user profiles.
 String retrieveToken(Object userProfile)
          Retrieves the user's authentication token from the UserProfile returned by the DFA API.
 

Method Detail

getLoginClass

Class<?> getLoginClass(String stubPackage)
                       throws ClassNotFoundException
Retrieves the Class object representing the login service.

Parameters:
stubPackage - the package where all generated stubs are located
Returns:
the Class object representing the login service
Throws:
ClassNotFoundException - if the class cannot be resolved

getUserProfileClass

Class<?> getUserProfileClass(String stubPackage)
                             throws ClassNotFoundException
Retrieves the Class object representing user profiles.

Parameters:
stubPackage - the package where all generated stubs are located
Returns:
the Class object representing user profiles
Throws:
ClassNotFoundException - if the class cannot be resolved

getLoginService

Object getLoginService(DfaSession session,
                       Class<?> loginClass)
Returns a DfaServiceClient wrapping the login service.

Parameters:
session - the DFA session
loginClass - the Class type of the login service
Returns:
a client pointing to the login service

authenticate

Object authenticate(String username,
                    String password,
                    Class<?> loginClass,
                    Object loginService)
                    throws IllegalArgumentException,
                           IllegalAccessException,
                           InvocationTargetException,
                           NoSuchMethodException
Authenticates against the DFA API.

Parameters:
username - the username
password - the password
loginClass - the Class type of the login service
loginService - a service client object wrapping the login service
Returns:
the UserProfile response from the API
Throws:
IllegalArgumentException - if one of the arguments used in authenticating is not allowed
IllegalAccessException - if the authenticate method cannot be accessed
InvocationTargetException - if an error occurs while invoking the authenticate method
NoSuchMethodException - if the authenticate method cannot be located

retrieveToken

String retrieveToken(Object userProfile)
                     throws ClassNotFoundException,
                            InvocationTargetException,
                            NoSuchMethodException,
                            IllegalAccessException
Retrieves the user's authentication token from the UserProfile returned by the DFA API.

Parameters:
userProfile - the UserProfile object returned by the API
Returns:
the users authentication token
Throws:
ClassNotFoundException - if the UserProfile class cannot be located
InvocationTargetException - if an error occurs while invoking getToken on the given object
NoSuchMethodException - if the getToken method cannot be found.
IllegalAccessException - if the getToken method cannot be accessed.


Copyright © 2012. All Rights Reserved.