Package org.encuestame.persistence.domain.security

Examples of org.encuestame.persistence.domain.security.UserAccount


    final NotificationResume notificationResume = new NotificationResume();
    try {
            final String username = getUserPrincipalUsername();
           
            log.debug("notifications-ws User get by getUserPrincipalUsername ---> " + getUserPrincipalUsername());
            UserAccount userAccount;
            if (!username.isEmpty()) {
                userAccount = getByUsername(username);
                if (userAccount != null) {
                    final Long totalNot = getNotificationDao().retrieveTotalNotificationStatus(userAccount.getAccount());
                    log.debug("totalNot "+totalNot);
                    final Long totalNewNot = getNotificationDao().retrieveTotalNotReadedNotificationStatus(userAccount.getAccount());
                    log.debug("totalNewNot "+totalNewNot);
                    notificationResume.setTotalNot(totalNot);
                    notificationResume.setTotalNewNot(totalNewNot);
                    log.debug(totalNewNot + " NEW of "+totalNot+" total not");
                } else {
View Full Code Here


            //@PathVariable final String type,
            HttpServletRequest request,
            HttpServletResponse response)
            throws JsonGenerationException, JsonMappingException, IOException {
        try {
            final UserAccount user = getUserAccount();
            final Options options = new Options();
            log.debug("Autosave TweetPoll Id --> " + tweetPollId);
            log.debug("Autosave Question --> " + question);
            final Map<String, Object> jsonResponse = new HashMap<String, Object>();
            if (tweetPollId == null && question != null && !question.isEmpty()) {
View Full Code Here

     *
     * @param user
     * @return
     */
    public static EnMeSocialUserAccount convertUserAccountToUserDetails(final SocialAccount connection) {
        final UserAccount user = connection.getUserOwner();
        final Collection<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
        authorities.addAll(ConvertDomainsToSecurityContext.convertEnMePermission(user.getSecUserPermissions()));
        final EnMeSocialUserAccount enMeSocialUserAccount = new EnMeSocialUserAccount(user.getUsername(),
                authorities,
                user.isUserStatus() == null ? false : user.isUserStatus(),
                true, // account not expired
                true, // credentials not expired
                true, // account not locked
                user.getCompleteName() == null ? "" : user.getCompleteName(), // complete name
                user.getUserEmail(), // user email
                user, connection.getAccounType(),
                connection.getSocialProfileId(),
                connection.getProfilePictureUrl());
        return enMeSocialUserAccount;
    }
View Full Code Here

     * @param account
     * @param password
     * @param socialSignIn
     */
    public static void socialAuthentication(final SocialAccount accountConnection) {
        final UserAccount account = accountConnection.getUserOwner();
        log.trace("Register SOCIAL LOGIN USER: " + account.getUsername());
        // building granted authorities
        final Collection<GrantedAuthority> authorities = ConvertDomainsToSecurityContext
                .convertEnMePermission(account.getSecUserPermissions());
        // create user detail based on user account.
        final EnMeSocialUserAccount details = SecurityUtils.convertUserAccountToUserDetails(accountConnection);
        // set the social credentials permission.
        details.setSocialCredentials(true);
        final SocialAuthenticationToken token = new SocialAuthenticationToken(details, authorities);
        token.setProfileId(accountConnection.getSocialProfileId());
        token.setProvider(accountConnection.getAccounType());
        //clear the context.
        SecurityContextHolder.clearContext();
        //set new authentication.
        SecurityContextHolder.getContext().setAuthentication(token);
        if (log.isInfoEnabled()) {
            log.info("Username " + account.getUsername() + " is logged at "
                    + new Date());
            log.debug("created EnMeSocialUserAccount" +details);
        }
    }
View Full Code Here

     * @return user domain
     * @throws EnMeNoResultsFoundException exception
     */
    public final UserAccount getUserAccount(final String username) throws EnMeNoResultsFoundException {
        log.debug("getUserAccount username:: "+username);
        final UserAccount userAccount =  this.findUserByUserName(username);
        if (userAccount == null) {
            log.info(" user not found {"+username+"}");
            throw new EnMeNoResultsFoundException(" user not found {"+username+"}");
        } else {
            //TODO: we can add others validations, like is disabled, banned or the account is expired.
View Full Code Here

     * @param userId user id
     * @return {@link UserAccount}.
     * @throws EnMeNoResultsFoundException
     */
   public final UserAccount getUserAccount(final Long userId) throws EnMeNoResultsFoundException {
        final UserAccount userAccount = getAccountDao().getUserAccountById(userId);
        if(userAccount == null){
            throw new EnMeNoResultsFoundException(" user id not found {"+userId+"}");
        } else {
            //TODO: we can add others validations, like is disabled, banned or the account is expired.
            return userAccount;
View Full Code Here

            }
            final UserAccountBean userBean = new UserAccountBean();
            userBean.setEmail(email);
            userBean.setUsername(username);
            // get the current user logged
            final UserAccount account = getUserAccount();
            final ValidateOperations cv = new ValidateOperations( getServiceManager().getApplicationServices()
                  .getSecurityService());
            boolean emailValid = cv.validateUserEmail(email, account);
            boolean usernameValid = cv.validateUsername(username, account);
            if (emailValid && usernameValid) {
View Full Code Here

            JsonMappingException, IOException {
        try {
            final Map<String, Object> jsonResponse = new HashMap<String, Object>();
            final String valueFilteres = filterValue(value);
            final ValidateOperations operations = new ValidateOperations(getSecurityService(), getUserAccount());
            final UserAccount account = getUserAccount();
            if (Profile.findProfile(type).equals(Profile.USERNAME)) {
                if (operations.validateUsername(valueFilteres, account)) {
                    jsonResponse.put("validate", true);
                } else {
                    jsonResponse.put("validate", false);
View Full Code Here

                final ValidateOperations validation = new ValidateOperations(
                        getSecurityService());
                boolean _isValidEmailFormat = validation.validateEmail(email);
                log.info("EMAIL FORMAT NOT VALID --> " + _isValidEmailFormat);
                if (_isValidEmailFormat) {
                     final UserAccount userValidate = validation.checkifEmailExist(email);
                     if (userValidate == null) {
                         result.rejectValue("email", "secure.email.notvalid", new Object[] { user.getEmail() }, "");
                     }
                     log.info("reCaptchaResponse " + reCaptchaResponse.isValid());
                     //validate reCaptcha
View Full Code Here

     * Find {@link UserAccount} by UserName
     * @param username user name
     * @return {@link UserAccount}
     */
    public UserAccountBean findUserByEmail(final String email) {
        final UserAccount secondary = getAccountDao().getUserByEmail(email);
        return secondary == null ? null : ConvertDomainBean.convertSecondaryUserToUserBean(secondary);
    }
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.security.UserAccount

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.