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
accessTokenIdResolverFields 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.voiddeletePersistentLogin(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.voidinvalidateTicket(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, setAccessTokenIdResolverMethods 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:AuthenticationServiceAuthenticates the user, and returns a ticket identifying the authentication.- Specified by:
authenticatein interfaceAuthenticationService- Parameters:
tenantName- the tenant's nameusername- the usernamepassword- the password- Returns:
- the ticket
- Throws:
ProfileException
-
createTicket
Description copied from interface:AuthenticationServiceCreate 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:
createTicketin interfaceAuthenticationService- Parameters:
profileId- the ID of the profile- Returns:
- the ticket
- Throws:
ProfileException
-
getTicket
Description copied from interface:AuthenticationServiceReturns the ticket object for the given ticket ID.- Specified by:
getTicketin 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:AuthenticationServiceInvalidates the ticket.- Specified by:
invalidateTicketin interfaceAuthenticationService- Parameters:
ticketId- the ID of the ticket to invalidate- Throws:
ProfileException
-
createPersistentLogin
Description copied from interface:AuthenticationServiceCreates a persistent login, use for remember me functionality.- Specified by:
createPersistentLoginin interfaceAuthenticationService- Parameters:
profileId- the ID of the profile- Returns:
- the persistent login
- Throws:
ProfileException
-
getPersistentLogin
Description copied from interface:AuthenticationServiceReturns the persistent login object for the given ID.- Specified by:
getPersistentLoginin interfaceAuthenticationService- Parameters:
loginId- the ID of the login- Returns:
- the persistent login, or null if not found
- Throws:
ProfileException
-
refreshPersistentLoginToken
Description copied from interface:AuthenticationServiceRefreshes the token of the specified persistent login.- Specified by:
refreshPersistentLoginTokenin interfaceAuthenticationService- Parameters:
loginId- the ID of the persistent login- Returns:
- the persistent login with the refreshed token
- Throws:
ProfileException
-
deletePersistentLogin
Description copied from interface:AuthenticationServiceDeletes the persistent login.- Specified by:
deletePersistentLoginin interfaceAuthenticationService- Parameters:
loginId- the ID of the login to invalidate- Throws:
ProfileException
-