Class SimpleCredentialsServiceImpl
java.lang.Object
ru.cg.webbpm.modules.security.api.impl.service.SimpleCredentialsServiceImpl
- All Implemented Interfaces:
CredentialsService<SimpleCredentials>
,SimpleCredentialsService
@Service
public class SimpleCredentialsServiceImpl
extends Object
implements SimpleCredentialsService
- Author:
- Bikmetov
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleCredentialsServiceImpl
(SimpleCredentialsDao simpleCredentialsDao, UserDao userDao) Simple credentials service constructor - creates new simple credential service. -
Method Summary
Modifier and TypeMethodDescriptionvoid
create
(SimpleCredentials authentication) Inserts simple credentials into database.Gets simple credentials by user account id.getByUsername
(String username) Get simple credentials by username.getPassword
(String username) Gets simple credentials password by username.void
update
(SimpleCredentials authentication) Updates simple credentials in database.
-
Constructor Details
-
SimpleCredentialsServiceImpl
@Autowired public SimpleCredentialsServiceImpl(SimpleCredentialsDao simpleCredentialsDao, UserDao userDao) Simple credentials service constructor - creates new simple credential service.- Parameters:
simpleCredentialsDao
- simple credentials data access object. Instance ofSimpleCredentials
type.userDao
- user account data access object. Instance ofUserDao
type.
-
-
Method Details
-
get
@Cacheable(value="simple-credentials-userAccountId", unless="#result == null") public SimpleCredentials get(String userId) Gets simple credentials by user account id.- Specified by:
get
in interfaceCredentialsService<SimpleCredentials>
- Parameters:
userId
- user account id of user to receive simple credentials. Instance ofString
type.- Returns:
- simple credentials or null if does not exist. Instance of
SimpleCredentials
type. - See Also:
-
getByUsername
@Cacheable(value="simple-credentials-username", unless="#result == null") public SimpleCredentials getByUsername(String username) Get simple credentials by username.- Specified by:
getByUsername
in interfaceCredentialsService<SimpleCredentials>
- Parameters:
username
- username of user to receive simple credentials. Instance ofString
type.- Returns:
- simple credentials or null if does not exist. Instance of
SimpleCredentials
type. - See Also:
-
getPassword
Gets simple credentials password by username.- Specified by:
getPassword
in interfaceSimpleCredentialsService
- Parameters:
username
- username of user to receive password. Instance ofString
type.- Returns:
- simple credentials password or null if does not exist. Instance of
String
type. - See Also:
-
create
@Transactional @CacheEvict(value="user-service-id", key="#authentication.userAccountId()", condition="#authentication.userAccountId() != null") public void create(SimpleCredentials authentication) Inserts simple credentials into database.- Specified by:
create
in interfaceSimpleCredentialsService
- Parameters:
authentication
- simple credentials to add. Instance ofSimpleCredentials
type.- See Also:
-
update
@Transactional @CacheEvict(value="simple-credentials-userAccountId",key="#authentication.userAccountId()") @CacheEvict(value="simple-credentials-username",key="#authentication.username()",condition="#authentication.username() != null") @CacheEvict(value="user-service-id",key="#authentication.userAccountId()") public void update(SimpleCredentials authentication) Updates simple credentials in database.- Specified by:
update
in interfaceSimpleCredentialsService
- Parameters:
authentication
- simple credentials to update. Instance ofSimpleCredentials
type.- See Also:
-