Package org.exoplatform.web.security

Examples of org.exoplatform.web.security.GateInToken


            if (en != null) {
                HashedToken hashedToken = getMixin(en, HashedToken.class);
                if (hashedToken != null && hashedToken.getHashedToken() != null) {
                    try {
                        if (saltedHashService.validate(token.getRandomString(), hashedToken.getHashedToken())) {
                            GateInToken encryptedToken = en.getToken();
                            Credentials encryptedCredentials = encryptedToken.getPayload();
                            Credentials decryptedCredentials = new Credentials(encryptedCredentials.getUsername(),

                            codec.decode(encryptedCredentials.getPassword()));
                            if (remove) {
                                en.remove();
                            }
                            return new GateInToken(encryptedToken.getExpirationTimeMillis(), decryptedCredentials);
                        }
                    } catch (SaltedHashException e) {
                        log.warn("Could not validate cookie token against its salted hash.", e);
                    }
                }
View Full Code Here


        if (credentials == null) {
            throw new NullPointerException();
        }
        String tokenId = nextTokenId();
        long expirationTimeMillis = System.currentTimeMillis() + validityMillis;
        tokens.put(tokenId, new GateInToken(expirationTimeMillis, credentials));
        return tokenId;
    }
View Full Code Here

        return stringKey;
    }

    @Override
    public GateInToken deleteToken(String id) {
        GateInToken token = tokens.get(id);
        tokens.remove(id);
        return token;
    }
View Full Code Here

    public GateInToken removeToken(String tokenId) {
        Map<String, TokenEntry> tokens = getTokens();
        TokenEntry entry = tokens.get(tokenId);
        if (entry != null) {
            GateInToken token = entry.getToken();
            entry.remove();
            return token;
        } else {
            return null;
        }
View Full Code Here

    public void cleanExpiredTokens() {
        Map<String, TokenEntry> tokens = getTokens();
        if (tokens != null) {
            for (TokenEntry en : tokens.values()) {
                GateInToken token = en.getToken();
                if (token.isExpired()) {
                    en.remove();
                }
            }
        }
    }
View Full Code Here

    @Destroy
    public abstract void remove();

    public GateInToken getToken() {
        return new GateInToken(getExpirationTime().getTime(), new Credentials(getUserName(), getPassword()));
    }
View Full Code Here

            if (en != null) {
                HashedToken hashedToken = getMixin(en, HashedToken.class);
                if (hashedToken != null && hashedToken.getHashedToken() != null) {
                    try {
                        if (saltedHashService.validate(token.getRandomString(), hashedToken.getHashedToken())) {
                            GateInToken encryptedToken = en.getToken();
                            Credentials encryptedCredentials = encryptedToken.getPayload();
                            Credentials decryptedCredentials = new Credentials(encryptedCredentials.getUsername(),

                            codec.decode(encryptedCredentials.getPassword()));
                            if (remove) {
                                en.remove();
                            }
                            return new GateInToken(encryptedToken.getExpirationTimeMillis(), decryptedCredentials);
                        }
                    } catch (SaltedHashException e) {
                        log.warn("Could not validate cookie token against its salted hash.", e);
                    }
                }
View Full Code Here

      {
         UIPortal uiPortal = event.getSource();
         RemindPasswordTokenService tokenService = uiPortal.getApplicationComponent(RemindPasswordTokenService.class);
         String tokenId = event.getRequestContext().getRequestParameter("tokenId");

         GateInToken token = tokenService.getToken(tokenId);
         if (token == null)
         {
            WebuiRequestContext requestContext = event.getRequestContext();
            requestContext.getUIApplication().addMessage(
                     new ApplicationMessage("UIForgetPassword.msg.expration", null));
            requestContext.addUIComponentToUpdateByAjax(uiPortal.getParent());
            return;
         }
        
         UIPortalApplication uiApp = uiPortal.getAncestorOfType(UIPortalApplication.class);
         UIMaskWorkspace uiMaskWS = uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);

         OrganizationService orgSrc = uiPortal.getApplicationComponent(OrganizationService.class);
         // get user
         User user = orgSrc.getUserHandler().findUserByName(token.getPayload().getUsername());

         UIResetPassword uiReset = uiMaskWS.createUIComponent(UIResetPassword.class, null, null);
         uiReset.setUser(user);
         uiReset.setTokenId(tokenId);
         uiMaskWS.setUIComponent(uiReset);
View Full Code Here

            if (en != null) {
                HashedToken hashedToken = getMixin(en, HashedToken.class);
                if (hashedToken != null && hashedToken.getHashedToken() != null) {
                    try {
                        if (saltedHashService.validate(token.getRandomString(), hashedToken.getHashedToken())) {
                            GateInToken encryptedToken = en.getToken();
                            Credentials encryptedCredentials = encryptedToken.getPayload();
                            Credentials decryptedCredentials = new Credentials(encryptedCredentials.getUsername(),

                            codec.decode(encryptedCredentials.getPassword()));
                            if (remove) {
                                en.remove();
                            }
                            return new GateInToken(encryptedToken.getExpirationTimeMillis(), decryptedCredentials);
                        }
                    } catch (SaltedHashException e) {
                        log.warn("Could not validate cookie token against its salted hash.", e);
                    }
                }
View Full Code Here

        if (credentials == null) {
            throw new NullPointerException();
        }
        String tokenId = nextTokenId();
        long expirationTimeMillis = System.currentTimeMillis() + validityMillis;
        tokens.put(tokenId, new GateInToken(expirationTimeMillis, credentials));
        return tokenId;
    }
View Full Code Here

TOP

Related Classes of org.exoplatform.web.security.GateInToken

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.