Java Code Examples for org.apache.catalina.realm.GenericPrincipal#getPassword()

The following examples show how to use org.apache.catalina.realm.GenericPrincipal#getPassword() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SerializablePrincipal.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public static SerializablePrincipal createPrincipal(GenericPrincipal principal)
{
    if ( principal==null) return null;
    return new SerializablePrincipal(principal.getName(),
                                     principal.getPassword(),
                                     principal.getRoles()!=null?Arrays.asList(principal.getRoles()):null,
                                     principal.getUserPrincipal()!=principal?principal.getUserPrincipal():null);
}
 
Example 2
Source File: SerializablePrincipal.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public static void writePrincipal(GenericPrincipal p, ObjectOutput out)
        throws IOException {
    out.writeUTF(p.getName());
    out.writeBoolean(p.getPassword()!=null);
    if ( p.getPassword()!= null ) out.writeUTF(p.getPassword());
    String[] roles = p.getRoles();
    if ( roles == null ) roles = new String[0];
    out.writeInt(roles.length);
    for ( int i=0; i<roles.length; i++ ) out.writeUTF(roles[i]);
    boolean hasUserPrincipal = (p != p.getUserPrincipal() &&
            p.getUserPrincipal() instanceof Serializable);
    out.writeBoolean(hasUserPrincipal);
    if (hasUserPrincipal) out.writeObject(p.getUserPrincipal());
}
 
Example 3
Source File: SerializablePrincipal.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public static SerializablePrincipal createPrincipal(GenericPrincipal principal)
{
    if ( principal==null) return null;
    return new SerializablePrincipal(principal.getName(),
                                     principal.getPassword(),
                                     principal.getRoles()!=null?Arrays.asList(principal.getRoles()):null,
                                     principal.getUserPrincipal()!=principal?principal.getUserPrincipal():null);
}
 
Example 4
Source File: SerializablePrincipal.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public static void writePrincipal(GenericPrincipal p, ObjectOutput out)
        throws IOException {
    out.writeUTF(p.getName());
    out.writeBoolean(p.getPassword()!=null);
    if ( p.getPassword()!= null ) out.writeUTF(p.getPassword());
    String[] roles = p.getRoles();
    if ( roles == null ) roles = new String[0];
    out.writeInt(roles.length);
    for ( int i=0; i<roles.length; i++ ) out.writeUTF(roles[i]);
    boolean hasUserPrincipal = (p != p.getUserPrincipal() &&
            p.getUserPrincipal() instanceof Serializable);
    out.writeBoolean(hasUserPrincipal);
    if (hasUserPrincipal) out.writeObject(p.getUserPrincipal());
}
 
Example 5
Source File: PBKDF2Realm.java    From teamengine with Apache License 2.0 5 votes vote down vote up
@Override
protected String getPassword(String username) {
    GenericPrincipal principal = (GenericPrincipal) getPrincipal(username);
    if (principal == null) {
        return null;
    } else {
        return principal.getPassword();
    }
}
 
Example 6
Source File: UserFilesRealm.java    From teamengine with Apache License 2.0 5 votes vote down vote up
@Override
protected String getPassword(String username) {
    GenericPrincipal principal = (GenericPrincipal) getPrincipal(username);
    if (principal == null) {
        return null;
    } else {
        return principal.getPassword();
    }
}
 
Example 7
Source File: InMemoryRealm.java    From oryx with Apache License 2.0 4 votes vote down vote up
@Override
protected String getPassword(String username) {
  GenericPrincipal principal = principals.get(username);
  return principal == null ? null : principal.getPassword();
}
 
Example 8
Source File: InMemoryRealm.java    From myrrix-recommender with Apache License 2.0 4 votes vote down vote up
@Override
protected String getPassword(String username) {
  GenericPrincipal principal = principals.get(username);
  return principal == null ? null : principal.getPassword();
}