/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright (c) 2009 Sun Microsystems Inc. All Rights Reserved * * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the License). You may not use this file except in * compliance with the License. * * You can obtain a copy of the License at * https://opensso.dev.java.net/public/CDDLv1.0.html or * opensso/legal/CDDLv1.0.txt * See the License for the specific language governing * permission and limitations under the License. * * When distributing Covered Code, include this CDDL * Header Notice in each file and include the License file * at opensso/legal/CDDLv1.0.txt. * If applicable, add the following below the CDDL Header, * with the fields enclosed by brackets [] replaced by * your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * $Id: AuthSPrincipal.java,v 1.1 2009/08/19 05:40:36 veiming Exp $ * * Portions Copyright 2015 ForgeRock AS. */ package com.sun.identity.rest; import java.security.Principal; /** *
* This class implements the Principal
interface that represents
* a user.
*
*
* AuthPrincipal
may be associated with a particular
* Subject
to augment that Subject
with an
* additional identity. Refer to the Subject
class for more
* information on how to achieve this. Authorization decisions can then be based
* upon the Principals associated with a Subject
.
*
*
* AuthSPrincipal
contains the "set" methods, whereas
* AuthPrincipal
contains just the "get" methods.
*
* @see java.security.Principal
* @see javax.security.auth.Subject
* @see com.sun.identity.authentication.internal.AuthPrincipal
*/
public class AuthSPrincipal implements Principal, java.io.Serializable {
protected String name;
protected String authMethod = null;
protected String authLevel = null;
// protected String distinguishedName = null;
/**
* Create an AuthSPrincipal with a username.
*
*
*
* @param name
* the username for this user.
*
* @exception NullPointerException
* if the name
is null
.
*/
public AuthSPrincipal(String name) {
if (name == null) {
throw new NullPointerException();
}
this.name = name;
}
/**
* Return the username for this AuthPrincipal
.
*
*
*
* @return the username for this AuthPrincipal
*/
public String getName() {
return name;
}
/**
* Return the AuthMethod for this AuthPrincipal
.
*
*
*
* @return the AuthMethod for this AuthPrincipal
*/
public String getAuthMethod() {
return authMethod;
}
/**
* Return the AuthLevel for this AuthPrincipal
.
*
*
*
* @return the AuthLevel for this AuthPrincipal
*/
public String getAuthLevel() {
return authLevel;
}
/**
* Set the AuthMethod for this AuthPrincipal
.
*
*
*
* @param auth_method
* AuthMethod for this AuthPrincipal
*/
protected void setAuthMethod(String auth_method) {
authMethod = auth_method;
}
/**
* Set the AuthLevel for this AuthPrincipal
.
*
*
*
* @param auth_level
* AuthLevel for this AuthPrincipal
*/
protected void setAuthLevel(String auth_level) {
authLevel = auth_level;
}
}