Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.keycloak.adapters.tomcat7;
 
Simple security principal implementation.

Author(s):
Marvin S. Addison
Version:
$Revision: 22071 $
Since:
3.1.11
public class SimplePrincipal implements PrincipalSerializable {

    
SimplePrincipal.java
    private static final long serialVersionUID = -5645357206342793145L;

    
The unique identifier for this principal.
    private final String name;

    
Creates a new principal with the given name.

Parameters:
name Principal name.
    public SimplePrincipal(final String name) {
        this. = name;
    }
    public final String getName() {
        return this.;
    }
    public String toString() {
        return getName();
    }
    public boolean equals(final Object o) {
        if (o == null) {
            return false;
        } else if (!(o instanceof SimplePrincipal)) {
            return false;
        } else {
            return getName().equals(((SimplePrincipal)o).getName());
        }
    }
    public int hashCode() {
        return 37 * getName().hashCode();
    }
New to GrepCode? Check out our FAQ X