Module com.gluonhq.cloudlink.client
Class LoginMethodImpl
- java.lang.Object
-
- com.gluonhq.impl.cloudlink.client.user.LoginMethodImpl
-
- All Implemented Interfaces:
LoginMethod
public class LoginMethodImpl extends Object implements LoginMethod
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.gluonhq.cloudlink.client.user.LoginMethod
LoginMethod.Type
-
-
Constructor Summary
Constructors Constructor Description LoginMethodImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCallbackUrl()
Constructs the URL that identifies the callback URL that will be called on Gluon CloudLink as the final step in the connect flow.Map<String,String>
getConfiguration()
String
getConnectUrl()
Constructs the URL that needs to be called to initiate the connect flow for this login method on Gluon CloudLink.String
getIdentifier()
RestClient
getLoginUrl(String username, String password)
Returns the URL that must be used when verifying the login credentials of a user when authenticating with theLoginMethod.Type.PASSWORD
orLoginMethod.Type.CUSTOM
login method.Optional<String>
getProperty(String key)
Return the value of a custom property of the LoginMethod.RestClient
getSignUpUrl(String name, String username, String password)
Returns the URL that must be used when signing up a new user that is authenticating with theLoginMethod.Type.PASSWORD
login method.LoginMethod.Type
getType()
Returns the type of the LoginMethod and defines which service will be used for connecting Gluon CloudLink users.void
setConfiguration(Map<String,String> configuration)
void
setIdentifier(String identifier)
void
setType(LoginMethod.Type type)
-
-
-
Method Detail
-
getIdentifier
public String getIdentifier()
-
setIdentifier
public void setIdentifier(String identifier)
-
getType
public LoginMethod.Type getType()
Returns the type of the LoginMethod and defines which service will be used for connecting Gluon CloudLink users.- Specified by:
getType
in interfaceLoginMethod
- Returns:
- the type of the LoginMethod.
-
setType
public void setType(LoginMethod.Type type)
-
getProperty
public Optional<String> getProperty(String key)
Description copied from interface:LoginMethod
Return the value of a custom property of the LoginMethod. Returns Optional.empty() if no property exists with the given key.- Specified by:
getProperty
in interfaceLoginMethod
- Parameters:
key
- the key of the property to look up- Returns:
- an Optional string containing the value of the property that matches the given key
-
getConnectUrl
public String getConnectUrl()
Constructs the URL that needs to be called to initiate the connect flow for this login method on Gluon CloudLink. The URL can be loaded into a WebView to start the flow.- Specified by:
getConnectUrl
in interfaceLoginMethod
- Returns:
- a string representing a URL to initiate the connect flow.
-
getCallbackUrl
public String getCallbackUrl()
Constructs the URL that identifies the callback URL that will be called on Gluon CloudLink as the final step in the connect flow. When the location property of a WebView's WebEngine starts with the callback URL, you know that the connect flow has finished.- Specified by:
getCallbackUrl
in interfaceLoginMethod
- Returns:
- a string representing the callback URL that indicates the end of the connect flow.
-
getLoginUrl
public RestClient getLoginUrl(String username, String password)
Returns the URL that must be used when verifying the login credentials of a user when authenticating with theLoginMethod.Type.PASSWORD
orLoginMethod.Type.CUSTOM
login method. The returned URL must be used in an HTTP POST request, providing the following form parameters:- username: the username of the user that was used when signing up
- password: the password of the user
- Specified by:
getLoginUrl
in interfaceLoginMethod
- Parameters:
username
- the username of the user that was used when signing uppassword
- the password of the user- Returns:
- the URL to use for verifying login credentials of a user
-
getSignUpUrl
public RestClient getSignUpUrl(String name, String username, String password)
Returns the URL that must be used when signing up a new user that is authenticating with theLoginMethod.Type.PASSWORD
login method. The returned URL must be used in an HTTP POST request, providing the following form parameters:- name: the full name of the user that is signing up (optional)
- username: the username of the user
- password: the password of the user
- Specified by:
getSignUpUrl
in interfaceLoginMethod
- Parameters:
name
- the full name of the user that is signing upusername
- the username of the user, used for future loginspassword
- the password of the user- Returns:
- the URL to use for signing up a new user
-
-