/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License, version 2 as published by the Free Software * Foundation. * * You should have received a copy of the GNU General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/gpl-2.0.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * * Copyright 2006 - 2013 Pentaho Corporation. All rights reserved. */ package org.pentaho.platform.repository2.unified.jcr.jackrabbit.security; import java.security.Principal; public class SpringSecurityUserPrincipal implements Principal { // ~ Static fields/initializers // ====================================================================================== // ~ Instance fields // ================================================================================================= private String name; // ~ Constructors // ==================================================================================================== public SpringSecurityUserPrincipal( final String name ) { super(); this.name = name; } // ~ Methods // ========================================================================================================= @Override public String getName() { return name; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ( ( name == null ) ? 0 : name.hashCode() ); return result; } @Override public boolean equals( Object obj ) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } SpringSecurityUserPrincipal other = (SpringSecurityUserPrincipal) obj; if ( name == null ) { if ( other.name != null ) { return false; } } else if ( !name.equals( other.name ) ) { return false; } return true; } @SuppressWarnings( "nls" ) @Override public String toString() { return "SpringSecurityUserPrincipal[name=" + name + "]"; } }