Class AuthenticationServiceRestClient
java.lang.Object
org.craftercms.commons.rest.AbstractRestClientBase
org.craftercms.profile.services.impl.AbstractProfileRestClientBase
org.craftercms.profile.services.impl.AuthenticationServiceRestClient
- All Implemented Interfaces:
AuthenticationService
public class AuthenticationServiceRestClient
extends AbstractProfileRestClientBase
implements AuthenticationService
REST client implementation of
AuthenticationService
.- Author:
- avasquez
-
Field Summary
Fields inherited from class org.craftercms.profile.services.impl.AbstractProfileRestClientBase
accessTokenIdResolver
Fields inherited from class org.craftercms.commons.rest.AbstractRestClientBase
baseUrl, extension, restTemplate
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthenticate
(String tenantName, String username, String password) Authenticates the user, and returns a ticket identifying the authentication.createPersistentLogin
(String profileId) Creates a persistent login, use for remember me functionality.createTicket
(String profileId) Create a new ticket for the specified profile.void
deletePersistentLogin
(String loginId) Deletes the persistent login.getPersistentLogin
(String loginId) Returns the persistent login object for the given ID.Returns the ticket object for the given ticket ID.void
invalidateTicket
(String ticketId) Invalidates the ticket.refreshPersistentLoginToken
(String loginId) Refreshes the token of the specified persistent login.Methods inherited from class org.craftercms.profile.services.impl.AbstractProfileRestClientBase
createBaseParams, doGetForObject, doGetForObject, doGetForObject, doGetForObject, doPostForLocation, doPostForObject, doPostForUpload, getAbsoluteUrlWithAccessTokenIdParam, handleException, handleRestServiceException, setAccessTokenIdResolver
Methods inherited from class org.craftercms.commons.rest.AbstractRestClientBase
getAbsoluteUrl, setBaseUrl, setExtension, setRestTemplate
-
Constructor Details
-
AuthenticationServiceRestClient
public AuthenticationServiceRestClient()
-
-
Method Details
-
authenticate
public Ticket authenticate(String tenantName, String username, String password) throws ProfileException Description copied from interface:AuthenticationService
Authenticates the user, and returns a ticket identifying the authentication.- Specified by:
authenticate
in interfaceAuthenticationService
- Parameters:
tenantName
- the tenant's nameusername
- the usernamepassword
- the password- Returns:
- the ticket
- Throws:
ProfileException
-
createTicket
Description copied from interface:AuthenticationService
Create a new ticket for the specified profile.Note: this method should only be used when authentication is done through other means (like when authenticating through Facebook or Twitter) different than profile, or when authenticating through a persistent login
- Specified by:
createTicket
in interfaceAuthenticationService
- Parameters:
profileId
- the ID of the profile- Returns:
- the ticket
- Throws:
ProfileException
-
getTicket
Description copied from interface:AuthenticationService
Returns the ticket object for the given ticket ID.- Specified by:
getTicket
in interfaceAuthenticationService
- Parameters:
ticketId
- the ID of the ticket- Returns:
- the ticket object, or null if no ticket found or ticket has expired
- Throws:
ProfileException
-
invalidateTicket
Description copied from interface:AuthenticationService
Invalidates the ticket.- Specified by:
invalidateTicket
in interfaceAuthenticationService
- Parameters:
ticketId
- the ID of the ticket to invalidate- Throws:
ProfileException
-
createPersistentLogin
Description copied from interface:AuthenticationService
Creates a persistent login, use for remember me functionality.- Specified by:
createPersistentLogin
in interfaceAuthenticationService
- Parameters:
profileId
- the ID of the profile- Returns:
- the persistent login
- Throws:
ProfileException
-
getPersistentLogin
Description copied from interface:AuthenticationService
Returns the persistent login object for the given ID.- Specified by:
getPersistentLogin
in interfaceAuthenticationService
- Parameters:
loginId
- the ID of the login- Returns:
- the persistent login, or null if not found
- Throws:
ProfileException
-
refreshPersistentLoginToken
Description copied from interface:AuthenticationService
Refreshes the token of the specified persistent login.- Specified by:
refreshPersistentLoginToken
in interfaceAuthenticationService
- Parameters:
loginId
- the ID of the persistent login- Returns:
- the persistent login with the refreshed token
- Throws:
ProfileException
-
deletePersistentLogin
Description copied from interface:AuthenticationService
Deletes the persistent login.- Specified by:
deletePersistentLogin
in interfaceAuthenticationService
- Parameters:
loginId
- the ID of the login to invalidate- Throws:
ProfileException
-