|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface AuthProvider
This is the main interface representing an authentication provider. First we call the getLoginRedirectURL method to get the URL where the user needs to be redirected. It is the responsibility of the caller to redirect the user to that URL. Once the external provider like Facebook redirects the user back to our application, we call the verifyResponse method and pass along the HttpRequest object that is called upon redirection. If the verifyResponse method returns a non null profile object, we can start calling the other methods to obtain user information, update status or import contacts
| Field Summary | |
|---|---|
static String |
COUNTRY
|
static String |
DOB
|
static String |
EMAIL
|
static String |
EXT_NAMESPACE
|
static String |
FIRST_NAME
|
static String |
FULL_NAME
|
static String |
GENDER
|
static String |
LANGUAGE
|
static String |
LAST_NAME
|
static String |
NICK_NAME
|
static String |
POSTCODE
|
| Method Summary | ||
|---|---|---|
Response |
api(String url,
String methodType,
Map<String,String> params,
Map<String,String> headerParams,
String body)
Makes OAuth signed HTTP request to a given URL for making any provider specific calls. |
|
AccessGrant |
getAccessGrant()
Retrieves the AccessGrant object. |
|
List<Contact> |
getContactList()
Gets the list of contacts of the user and their email. |
|
String |
getLoginRedirectURL(String successUrl)
This is the most important action. |
|
|
getPlugin(Class<T> clazz)
|
|
String |
getProviderId()
Retrieves the provider id |
|
Profile |
getUserProfile()
Retrieves the user profile. |
|
boolean |
isSupportedPlugin(Class<? extends Plugin> clazz)
|
|
void |
logout()
Logout |
|
void |
registerPlugins()
|
|
void |
setAccessGrant(AccessGrant accessGrant)
Stores access grant for the provider * |
|
void |
setPermission(Permission p)
|
|
void |
updateStatus(String msg)
Updates the status on the chosen provider if available. |
|
Response |
uploadImage(String message,
String fileName,
InputStream inputStream)
Updates the image and message on the chosen provider if available. |
|
Profile |
verifyResponse(Map<String,String> requestParams)
Verifies the user when the external provider redirects back to our application. |
|
| Field Detail |
|---|
static final String EXT_NAMESPACE
static final String EMAIL
static final String COUNTRY
static final String LANGUAGE
static final String FULL_NAME
static final String NICK_NAME
static final String DOB
static final String GENDER
static final String POSTCODE
static final String FIRST_NAME
static final String LAST_NAME
| Method Detail |
|---|
String getLoginRedirectURL(String successUrl)
throws Exception
Exception
Profile verifyResponse(Map<String,String> requestParams)
throws Exception
requestParams - Request parameters received from the provider
Exception
void updateStatus(String msg)
throws Exception
msg - Message to be shown as user's status
Exception
List<Contact> getContactList()
throws Exception
Exception
Profile getUserProfile()
throws Exception
Exceptionvoid logout()
void setPermission(Permission p)
p - Permission object which can be Permission.AUHTHENTICATE_ONLY,
Permission.ALL, Permission.DEFAULT
Response api(String url,
String methodType,
Map<String,String> params,
Map<String,String> headerParams,
String body)
throws Exception
url - URL to make HTTP request.methodType - Method type can be GET, POST or PUTparams - Any additional parameters whose signature need to compute.
Only used in case of "POST" and "PUT" method type.headerParams - Any additional parameters need to pass as Header Parametersbody - Request Body
ExceptionAccessGrant getAccessGrant()
String getProviderId()
void setAccessGrant(AccessGrant accessGrant)
throws Exception
accessGrant - It contains the access token and other information
Exception
Response uploadImage(String message,
String fileName,
InputStream inputStream)
throws Exception
message - Status MessagefileName - Image file nameinputStream - Input Stream of image
Exceptionboolean isSupportedPlugin(Class<? extends Plugin> clazz)
<T> T getPlugin(Class<T> clazz)
throws Exception
Exception
void registerPlugins()
throws Exception
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||