Package com.mossle.api.userauth

Examples of com.mossle.api.userauth.UserAuthDTO


@Component
public class AuthCache {
    private UserAuthCache userAuthCache;

    public void evictUserStatus(UserStatus userStatus) {
        UserAuthDTO userAuthDto = new UserAuthDTO();
        userAuthDto.setId(Long.toString(userStatus.getId()));
        userAuthDto.setUsername(userStatus.getUsername());
        userAuthDto.setRef(userStatus.getRef());
        userAuthDto.setScopeId(userStatus.getScopeId());
        userAuthCache.removeUserAuth(userAuthDto);
    }
View Full Code Here


            logger.debug("userAuthInSession is null");

            return securityContext;
        }

        UserAuthDTO userAuthInCache = userAuthConnector.findById(
                userAuthInSession.getId(), userAuthInSession.getScopeId());

        SpringSecurityUserAuth userAuthResult = new SpringSecurityUserAuth();
        beanMapper.copy(userAuthInCache, userAuthResult);
View Full Code Here

            return userAuth;
        }

        try {
            UserAuthDTO userAuthDto = userAuthConnector.findByUsername(
                    username, ScopeHolder.getScopeId());

            SpringSecurityUserAuth userAuthResult = new SpringSecurityUserAuth();
            beanMapper.copy(userAuthDto, userAuthResult);
View Full Code Here

public class UserAuthConnectorWrapper implements UserAuthConnector {
    private UserAuthConnector userAuthConnector;
    private UserAuthCache userAuthCache;

    public UserAuthDTO findByUsername(String username, String scopeId) {
        UserAuthDTO userAuthDto = userAuthCache.findByUsername(username,
                scopeId);

        if (userAuthDto == null) {
            synchronized (userAuthCache) {
                userAuthDto = userAuthCache.findByUsername(username, scopeId);
View Full Code Here

        return userAuthDto;
    }

    public UserAuthDTO findByRef(String ref, String scopeId) {
        UserAuthDTO userAuthDto = userAuthCache.findByRef(ref, scopeId);

        if (userAuthDto == null) {
            synchronized (userAuthCache) {
                userAuthDto = userAuthCache.findByRef(ref, scopeId);
View Full Code Here

        return userAuthDto;
    }

    public UserAuthDTO findById(String id, String scopeId) {
        UserAuthDTO userAuthDto = userAuthCache.findById(id, scopeId);

        if (userAuthDto == null) {
            synchronized (userAuthCache) {
                userAuthDto = userAuthCache.findById(id, scopeId);
View Full Code Here

    private ScopeConnector scopeConnector;
    private UserConnector userConnector;
    private UserAuthDTO userAuthDto;

    public MockUserAuthConnector() {
        userAuthDto = new UserAuthDTO();
        userAuthDto.setId("1");
        userAuthDto.setScopeId("1");
        userAuthDto.setUsername("lingo");
        userAuthDto.setRef("1");
        userAuthDto.setDisplayName("lingo");
View Full Code Here

            UserDTO userDto = jsonMapper.fromJson(message, UserDTO.class);

            userCache.removeUser(userDto);

            for (ScopeDTO scopeDto : scopeConnector.findAll()) {
                UserAuthDTO userAuthDto = userAuthConnector.findByUsername(
                        userDto.getUsername(), scopeDto.getId());
                userAuthCache.removeUserAuth(userAuthDto);
            }

            logger.info("remove user : {}", message);
View Full Code Here

            UserDTO userDto = jsonMapper.fromJson(message, UserDTO.class);

            userCache.updateUser(userDto);

            for (ScopeDTO scopeDto : scopeConnector.findAll()) {
                UserAuthDTO userAuthDto = userAuthConnector.findByUsername(
                        userDto.getUsername(), scopeDto.getId());
                userAuthCache.updateUserAuth(userAuthDto);
            }

            logger.info("update user : {}", message);
View Full Code Here

        return process(userDto, scopeDto, false);
    }

    public UserAuthDTO process(UserDTO userDto, ScopeDTO scopeDto,
            boolean needPassword) {
        UserAuthDTO userAuthDto = new UserAuthDTO();
        userAuthDto.setId(userDto.getId());
        userAuthDto.setScopeId(scopeDto.getId());
        userAuthDto.setUsername(userDto.getUsername());
        userAuthDto.setRef(userDto.getRef());
        userAuthDto.setDisplayName(userDto.getDisplayName());
        userAuthDto.setStatus(Integer.toString(userDto.getStatus()));

        // password
        if (needPassword) {
            String password = jdbcTemplate.queryForObject(sqlFindPassword,
                    String.class, userDto.getId());
            userAuthDto.setPassword(password);
        }

        // permissions
        List<Map<String, Object>> permissions = jdbcTemplate.queryForList(
                sqlFindPermissions, userDto.getId(), scopeDto.getId());
        userAuthDto.setPermissions(this.convertMapListToStringList(permissions,
                "permission"));

        // roles
        List<Map<String, Object>> roles = jdbcTemplate.queryForList(
                sqlFindRoles, userDto.getId(), scopeDto.getId());
        userAuthDto.setRoles(this.convertMapListToStringList(roles, "role"));

        return userAuthDto;
    }
View Full Code Here

TOP

Related Classes of com.mossle.api.userauth.UserAuthDTO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.