Package org.apache.shiro.crypto.hash

Examples of org.apache.shiro.crypto.hash.Sha512Hash


     * Creates a new <em>uninitialized</em> {@link Sha512Hash Sha512Hash} instance, without it's byte array set.
     *
     * @return a new <em>uninitialized</em> {@link org.apache.shiro.crypto.hash.Sha512Hash Sha512Hash} instance, without it's byte array set.
     */
    protected AbstractHash newHashInstance() {
        return new Sha512Hash();
    }
View Full Code Here


    /**
     * This implementation merely returns
     * <code>new {@link Sha512Hash#Sha512Hash(Object, Object, int) Sha512Hash(credentials,salt,hashIterations)}</code>.
     */
    protected Hash hashProvidedCredentials(Object credentials, Object salt, int hashIterations) {
        return new Sha512Hash(credentials, salt, hashIterations);
    }
View Full Code Here

    public Class<? extends HashedCredentialsMatcher> getMatcherClass() {
        return Sha512CredentialsMatcher.class;
    }

    public AbstractHash hash(Object credentials) {
        return new Sha512Hash(credentials);
    }
View Full Code Here

    public Class<? extends HashedCredentialsMatcher> getMatcherClass() {
        return Sha512CredentialsMatcher.class;
    }

    public AbstractHash hash(Object credentials) {
        return new Sha512Hash(credentials);
    }
View Full Code Here

     *          on login failure.
     */
    @Override
    public boolean login(User user, String password) {
        UsernamePasswordToken token = new UsernamePasswordToken(user.getUsername(),
                new Sha512Hash(password).toHex());

        subject.login(token);
        if (subject.isAuthenticated()) {
            sessionId = subject.getSession().getId();
        } else {
View Full Code Here

        UsernamePasswordToken token = (UsernamePasswordToken) authToken;

        User user = (User) identityManagerment.findByUsername(token.getUsername());

        if (user != null) {
            return new SimpleAuthenticationInfo(user.getId(), new Sha512Hash(user.getPassword()), getName());
        } else {
            throw new RuntimeException("Authentication failed");
        }
    }
View Full Code Here

     * @param password
     */
    @Override
    public void create(User user, String password) {
        User newUser = new User(user.getUsername(),
                new Sha512Hash(password).toHex());
        entityManager.persist(newUser);
    }
View Full Code Here

TOP

Related Classes of org.apache.shiro.crypto.hash.Sha512Hash

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.