Search in sources :

Example 1 with CacheableAuthInfo

use of org.neo4j.server.security.enterprise.auth.plugin.spi.CacheableAuthInfo in project neo4j by neo4j.

the class PluginAuthInfo method createCacheable.

public static PluginAuthInfo createCacheable(AuthInfo authInfo, String realmName, SecureHasher secureHasher) {
    if (authInfo instanceof CacheableAuthInfo) {
        byte[] credentials = ((CacheableAuthInfo) authInfo).credentials();
        SimpleHash hashedCredentials = secureHasher.hash(credentials);
        return new PluginAuthInfo(authInfo, hashedCredentials, realmName);
    } else {
        return new PluginAuthInfo(authInfo.principal(), realmName, authInfo.roles().stream().collect(Collectors.toSet()));
    }
}
Also used : SimpleHash(org.apache.shiro.crypto.hash.SimpleHash) CacheableAuthInfo(org.neo4j.server.security.enterprise.auth.plugin.spi.CacheableAuthInfo)

Aggregations

SimpleHash (org.apache.shiro.crypto.hash.SimpleHash)1 CacheableAuthInfo (org.neo4j.server.security.enterprise.auth.plugin.spi.CacheableAuthInfo)1