Package org.cyclos.impl.access
Class LoginServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.access.LoginServiceImpl
-
- All Implemented Interfaces:
LoginServiceLocal,LoginService,Service
@Service public class LoginServiceImpl extends BaseServiceImpl implements LoginServiceLocal
Implementation forLoginService
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, customFieldValueHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
-
Constructor Summary
Constructors Constructor Description LoginServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckSecondaryPassword(String password)Validate the secondary password for the logged userPair<Session,IdentityProviderNotLinkReason>doLogin(TimeInterval customSessionTimeout, Long deviceConfirmationId, Long deviceId, String hmac, String identityProviderRequestId, String fcmDeviceToken)Logs in the current user.
If a device confirmation id, device id and HMAC are given then the following happen: For authenticated users: If valid a trusted session will be created which means higher payment limits could be applied, the confirmation password could be skipped (there is a setting in the channel configuration), etc.SessiondoLoginUser(UserLoginDTO params)Logs in the given userUserAuthVOgetAuthenticatedUser()Returns the currently authenticated userDateRangegetFirstAndLastLogin(BasicUser user)Returns the first and last login of the given user, or null if never logged in beforeLoginDatagetLoginData(String channelName, Long deviceId, PinLocatorVO pinLocator)Returns the data for user login according to the given channel name and based in the current session configuration.LoginDatagetLoginData(Channel channel, Long deviceId, PinLocatorVO pinLocator)Returns the data for user login according to the given channel.
Optionally, a trusted device id and pin locator can be given to know if they already exist and are active.PasswordInputDTOgetSecondaryPasswordInput()Returns the input for the secondary password for the logged user.UserLoginResultlogin(LoginDTO params)Creates a session for the currently authenticated user and optionally sets a timeout for it.UserLoginDetailedResultloginUser(UserLoginDTO params)Creates a session for a user, indicating a remote address (from the client connection) a channel and optionally a timeout.
Must be called by administrators with permissions to login other users, and is used when there is a system which relays logins to Cyclos.voidlogout()Invalidates the current user session, if the current request was authenticated with a sessionbooleanlogoutUser(String token)Removes the session with the given token, returning whether the sessions was actually removedprotected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the networkvoidremoveAllLogs(BasicUser basicUser)Removes all login history logs for the given userStringreplaceSession()Replaces the current session token with another one.-
Methods inherited from class org.cyclos.impl.BaseServiceImpl
initializeNetworkMappings
-
Methods inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
canManage, checkManagesUser, checkPermission, checkRelatesToUser, checkValue, clearAlreadyValidated, getBaseEntityManagerHandler, getConfiguration, getLoggedBasicUser, getLoggedUser, getProducts, getTranslatedName, getTranslatedValue, hasPermission, hasValue, inSameNetwork, inSameNetworkOrGlobal, isAdmin, isAlreadyValidated, isBroker, isGlobalAdmin, isGlobalAdminInNetwork, isGuest, isLoggedIn, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRelatedToUser, isSystem, isUserManager, isUserManagerOf, message, message, permission, permission, permissionOptionalValue, permissionOptionalValue, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, delete, detach, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
-
-
-
Method Detail
-
checkSecondaryPassword
public void checkSecondaryPassword(String password)
Description copied from interface:LoginServiceValidate the secondary password for the logged user- Specified by:
checkSecondaryPasswordin interfaceLoginService
-
doLogin
public Pair<Session,IdentityProviderNotLinkReason> doLogin(TimeInterval customSessionTimeout, Long deviceConfirmationId, Long deviceId, String hmac, String identityProviderRequestId, String fcmDeviceToken)
Description copied from interface:LoginServiceLocalLogs in the current user.
If a device confirmation id, device id and HMAC are given then the following happen:- For authenticated users: If valid a trusted session will be created which means higher payment limits could be applied, the confirmation password could be skipped (there is a setting in the channel configuration), etc. Otherwise, the session (silently) won't be trusted and the confirmation password will be required according to the channel configuration.
- For guests: means a login with a trusted device is performing. For this case the session will be also trusted
if the parameters are valid. Otherwise a
LoginExceptionwill be thrown.
- Specified by:
doLoginin interfaceLoginServiceLocal
-
doLoginUser
public Session doLoginUser(UserLoginDTO params)
Description copied from interface:LoginServiceLocalLogs in the given user- Specified by:
doLoginUserin interfaceLoginServiceLocal
-
getAuthenticatedUser
public UserAuthVO getAuthenticatedUser() throws FrameworkException
Description copied from interface:LoginServiceReturns the currently authenticated user- Specified by:
getAuthenticatedUserin interfaceLoginService- Throws:
FrameworkException
-
getFirstAndLastLogin
public DateRange getFirstAndLastLogin(BasicUser user)
Description copied from interface:LoginServiceLocalReturns the first and last login of the given user, or null if never logged in before- Specified by:
getFirstAndLastLoginin interfaceLoginServiceLocal
-
getLoginData
public LoginData getLoginData(Channel channel, Long deviceId, PinLocatorVO pinLocator)
Description copied from interface:LoginServiceLocalReturns the data for user login according to the given channel.
Optionally, a trusted device id and pin locator can be given to know if they already exist and are active.- Specified by:
getLoginDatain interfaceLoginServiceLocal
-
getLoginData
public LoginData getLoginData(String channelName, Long deviceId, PinLocatorVO pinLocator)
Description copied from interface:LoginServiceReturns the data for user login according to the given channel name and based in the current session configuration.- Specified by:
getLoginDatain interfaceLoginServicedeviceId- (Optional) A trusted device id can be given to know if it is operative, if so then a pending device confirmation will be created (in a new read-write transaction) and its id returned in the result data. Otherwise no confirmation will be created.pinLocator- (Optional) A device pin locator can be given to know it it is operative
-
getSecondaryPasswordInput
public PasswordInputDTO getSecondaryPasswordInput()
Description copied from interface:LoginServiceReturns the input for the secondary password for the logged user.- Specified by:
getSecondaryPasswordInputin interfaceLoginService
-
login
public UserLoginResult login(LoginDTO params) throws FrameworkException, LoginException, RemoteAddressBlockedException
Description copied from interface:LoginServiceCreates a session for the currently authenticated user and optionally sets a timeout for it. Also, if an identity provider state id is given, and such state exists, the user that performed the login will be linked to that provider- Specified by:
loginin interfaceLoginService- Throws:
FrameworkExceptionLoginExceptionRemoteAddressBlockedException
-
loginUser
public UserLoginDetailedResult loginUser(UserLoginDTO params) throws FrameworkException, LoginException, RemoteAddressBlockedException
Description copied from interface:LoginServiceCreates a session for a user, indicating a remote address (from the client connection) a channel and optionally a timeout.
Must be called by administrators with permissions to login other users, and is used when there is a system which relays logins to Cyclos.- Specified by:
loginUserin interfaceLoginService- Throws:
FrameworkExceptionLoginExceptionRemoteAddressBlockedException
-
logout
public void logout() throws FrameworkExceptionDescription copied from interface:LoginServiceInvalidates the current user session, if the current request was authenticated with a session- Specified by:
logoutin interfaceLoginService- Throws:
FrameworkException
-
logoutUser
public boolean logoutUser(String token) throws FrameworkException
Description copied from interface:LoginServiceRemoves the session with the given token, returning whether the sessions was actually removed- Specified by:
logoutUserin interfaceLoginService- Throws:
FrameworkException
-
removeAllLogs
public void removeAllLogs(BasicUser basicUser)
Description copied from interface:LoginServiceLocalRemoves all login history logs for the given user- Specified by:
removeAllLogsin interfaceLoginServiceLocal
-
replaceSession
public String replaceSession() throws FrameworkException
Description copied from interface:LoginServiceReplaces the current session token with another one. Only works if the current authentication is done via a session. The current session will have a new token generated, and that token is returned. If not connected as a session, will return null.- Specified by:
replaceSessionin interfaceLoginService- Throws:
FrameworkException
-
registerNetworkMappings
protected void registerNetworkMappings(NetworkPathRegistry networkPathRegistry)
Description copied from class:BaseServiceImplNeeds to be overridden by subclasses to register the path up to the network- Specified by:
registerNetworkMappingsin classBaseServiceImpl
-
-