Example usage for org.apache.shiro.authc.credential SimpleCredentialsMatcher SimpleCredentialsMatcher

List of usage examples for org.apache.shiro.authc.credential SimpleCredentialsMatcher SimpleCredentialsMatcher

Introduction

In this page you can find the example usage for org.apache.shiro.authc.credential SimpleCredentialsMatcher SimpleCredentialsMatcher.

Prototype

SimpleCredentialsMatcher

Source Link

Usage

From source file:com.mingsoft.basic.security.BaseAuthRealm.java

License:Open Source License

/**
 * /*  www . j  a va2s . c o  m*/
 */
public BaseAuthRealm() {
    // TODO Auto-generated constructor stub
    super();
    // ?token
    setAuthenticationTokenClass(UsernamePasswordToken.class);
    // 
    setCredentialsMatcher(new SimpleCredentialsMatcher());
}

From source file:com.zboss.fw.authc.shiro.ShiroRealm.java

License:Apache License

/**
 * PasswordHash.
 */
@PostConstruct
public void initCredentialsMatcher() {
    setCredentialsMatcher(new SimpleCredentialsMatcher());
}

From source file:de.fatalix.app.bl.authentication.CDIAwareShiroEnvironmentLoader.java

@Override
protected WebEnvironment createEnvironment(ServletContext sc) {
    WebEnvironment webEnvironment = super.createEnvironment(sc);

    RealmSecurityManager rsm = (RealmSecurityManager) webEnvironment.getSecurityManager();
    SimpleCredentialsMatcher credentialsMatcher = new SimpleCredentialsMatcher();

    jpaRealm.setCredentialsMatcher(credentialsMatcher);
    Collection<Realm> realms = rsm.getRealms();
    realms.add(jpaRealm);//from  w  w  w  . j  av a2 s  .  com
    rsm.setRealms(realms);

    ((DefaultWebEnvironment) webEnvironment).setSecurityManager(rsm);
    return webEnvironment;
}

From source file:eu.eubrazilcc.lvl.storage.security.shiro.LinkedInRealm.java

License:EUPL

public LinkedInRealm() {
    super(new SimpleCredentialsMatcher(), LINKEDIN_IDENTITY_PROVIDER);
    // add support for token-based authentication
    setAuthenticationTokenClass(AccessTokenToken.class);
}

From source file:eu.eubrazilcc.lvl.storage.security.shiro.LvlRealm.java

License:EUPL

public LvlRealm() {
    super(new SimpleCredentialsMatcher(), LVL_IDENTITY_PROVIDER);
    // add support for token-based authentication
    setAuthenticationTokenClass(AccessTokenToken.class);
}

From source file:org.apache.usergrid.chop.webapp.service.shiro.ShiroRealm.java

License:Apache License

public ShiroRealm() {
    super(new MemoryConstrainedCacheManager(), new SimpleCredentialsMatcher());
}

From source file:org.sonatype.nexus.ldap.LdapRealm.java

License:Open Source License

@Inject
public LdapRealm(final EventBus eventBus, final LdapManager ldapManager) {
    this.ldapManager = checkNotNull(ldapManager);
    setName(LdapConstants.REALM_NAME);//from  www  .ja va  2 s. c  o m
    setAuthenticationCachingEnabled(true);
    setAuthorizationCachingEnabled(true);
    // using simple credentials matcher
    setCredentialsMatcher(new SimpleCredentialsMatcher());

    eventBus.register(this);
}

From source file:org.sonatype.security.realms.ldap.realms.LdapRealm.java

License:Open Source License

@Inject
public LdapRealm(final EventBus eventBus, final LdapManager ldapManager) {
    this.ldapManager = checkNotNull(ldapManager);
    setName(LdapPlugin.REALM_NAME);//from  w  w w.  j a  va 2s .c  o  m
    setAuthenticationCachingEnabled(true);
    setAuthorizationCachingEnabled(true);
    // using simple credentials matcher
    setCredentialsMatcher(new SimpleCredentialsMatcher());

    eventBus.register(this);
}

From source file:org.sonatype.security.realms.MemoryAuthenticationOnlyRealm.java

License:Open Source License

/**
 * This is where we are building the security model, not that the passwords have
 * been changed from the default nexus security, to make for easy validation
 *///from  ww  w.  j a  v a2s . co m
public MemoryAuthenticationOnlyRealm() {
    // As this is a simple test realm, only using simple credentials
    // just a string compare, no hashing involved
    setCredentialsMatcher(new SimpleCredentialsMatcher());

    authenticationMap.put("admin", "admin321");
    authenticationMap.put("deployment", "deployment321");
    authenticationMap.put("anonymous", "anonymous");
}

From source file:org.sonatype.security.realms.MemoryRealm.java

License:Open Source License

/**
 * This is where we are building our security model, 3 users available: 
 * admin/deployment/anonymous/*  w  w  w  . ja  v  a  2s. com*/
 * 
 * Each of these users each has their own privileges, based upon the default settings
 * in nexus security
 */
public MemoryRealm() {
    // As this is a simple test realm, only using simple credentials
    // just a string compare, no hashing involved
    setCredentialsMatcher(new SimpleCredentialsMatcher());

    authenticationMap.put("admin", "admin123");
    authenticationMap.put("deployment", "deployment123");
    authenticationMap.put("anonymous", "anonymous");

    // Block all of the security related permissions, as they wont be used
    // with an external security system
    blockedPermissions.add(new WildcardPermission("nexus:privileges:*"));
    blockedPermissions.add(new WildcardPermission("nexus:roles:*"));
    blockedPermissions.add(new WildcardPermission("nexus:users:*"));
    blockedPermissions.add(new WildcardPermission("nexus:usersforgotpw:*"));
    blockedPermissions.add(new WildcardPermission("nexus:usersforgotid:*"));
    blockedPermissions.add(new WildcardPermission("nexus:usersreset:*"));
    blockedPermissions.add(new WildcardPermission("nexus:userschangepw:*"));

    // Admin gets the ALL privilege, thus allowing access
    // to everything.
    Set<String> perms = new HashSet<String>();
    perms.add("nexus:*:*");
    authorizationMap.put("admin", perms);

    // Anonymous gets the default anonymous privileges
    perms = new HashSet<String>();
    perms.add("nexus:status:read");
    perms.add("nexus:repositories:read");
    perms.add("nexus:repogroups:read");
    perms.add("nexus:index:read");
    perms.add("nexus:identify:read");
    perms.add("nexus:feeds:read");
    perms.add("nexus:artifact:read");
    perms.add("nexus:repostatus:read");
    perms.add("nexus:repocontentclasses:read");
    // Target privileges, that allow read access to everything
    // The numbers below (1 & 2) are Repository Target IDs in nexus
    // The asterisk means that this privilege applies to any repository
    perms.add("nexus:target:1:*:read");
    perms.add("nexus:target:2:*:read");
    authorizationMap.put("anonymous", perms);

    // Deployment gets the anon permissions, plus
    // the ability to login
    perms = new HashSet<String>();
    perms.add("nexus:authentication:read");
    perms.add("nexus:status:read");
    perms.add("nexus:repositories:read");
    perms.add("nexus:repogroups:read");
    perms.add("nexus:index:read");
    perms.add("nexus:identify:read");
    perms.add("nexus:feeds:read");
    perms.add("nexus:artifact:read");
    perms.add("nexus:repostatus:read");
    perms.add("nexus:repocontentclasses:read");
    perms.add("nexus:target:1:*:read");
    perms.add("nexus:target:2:*:read");
    perms.add("nexus:target:1:*:update");
    perms.add("nexus:target:2:*:update");
    perms.add("nexus:target:1:*:create");
    perms.add("nexus:target:2:*:create");
    perms.add("nexus:target:1:*:delete");
    perms.add("nexus:target:2:*:delete");
    authorizationMap.put("deployment", perms);
}