001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
005 *
006 * The contents of this file are subject to the terms
007 * of the Common Development and Distribution License
008 * (the License). You may not use this file except in
009 * compliance with the License.
010 *
011 * You can obtain a copy of the License at
012 * https://opensso.dev.java.net/public/CDDLv1.0.html or
013 * opensso/legal/CDDLv1.0.txt
014 * See the License for the specific language governing
015 * permission and limitations under the License.
016 *
017 * When distributing Covered Code, include this CDDL
018 * Header Notice in each file and include the License file
019 * at opensso/legal/CDDLv1.0.txt.
020 * If applicable, add the following below the CDDL Header,
021 * with the fields enclosed by brackets [] replaced by
022 * your own identifying information:
023 * "Portions Copyrighted [year] [name of copyright owner]"
024 *
025 * $Id: Subject.java,v 1.2 2008/06/25 05:48:12 qcheng Exp $
026 *
027 */
028
029package com.sun.identity.xacml.context;
030
031import com.sun.identity.xacml.common.XACMLException;
032
033import java.util.List;
034import java.net.URI;
035
036/**
037 * The <code>Subject</code> element specifies information about a
038 * subject of the <code>Request</code> context by listing a 
039 * sequence of <code>Attribute</code> elements associated with the
040 * subject. A subject is an entity associated with the access request.
041 * <p>
042 * <pre>
043 * &lt;xs:complexType name="SubjectType">
044 *  &lt;xs:sequence>
045 *   &lt;xs:element ref="xacml-context:Attribute" minOccurs="0"
046 *      maxOccurs="unbounded"/>
047 * &lt;xs:sequence>
048 * &lt;xs:attribute name="SubjectCategory" type="xs:anyURI" 
049 *  default="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"/>
050 * &lt;xs:complexType>
051 * </pre>
052 *@supported.all.api
053 */
054public interface Subject {
055    /**
056     * Returns zero to many <code>Attribute</code> elements of this object
057     * If no attributes and present, empty <code>List</code> will be returned.
058     * Typically a <code>Subject</code> element will contain an <code>
059     * Attribute</code> with an <code>AttributeId</code> of
060     * "urn:oasis:names:tc:xacml:1.0:subject:subject-id", containing 
061     * the identity of the <code>Subject</code>
062     *
063     * @return the <code>Attribute</code> elements of this object
064     */
065    public List getAttributes();
066
067    /**
068     * Sets the <code>Attribute</code> elements of this object
069     *
070     * @param attributes <code>Attribute</code> elements of this object
071     * attributes could be an empty <code>List</code>, if no attributes
072     * are present.
073     *
074     * @exception XACMLException if the object is immutable
075     * An object is considered <code>immutable</code> if <code>
076     * makeImmutable()</code> has been invoked on it. It can
077     * be determined by calling <code>isMutable</code> on the object.
078     */
079    public void setAttributes(List attributes) throws XACMLException;
080
081    /**
082     * Returns the <code>SubjectCategory</code> of this object.
083     * This is optional so could be null if not defined.
084     * This attribute indicates the role that the parent <code>Subject</code> 
085     * played in the formation of the access request. If this attribute is not 
086     * present in the <code>Subject</code> element, then the
087     * default value of 
088     * urn:oasis:names:tc:xacml:1.0:subject-category:access-subject SHALL be
089     * used, indicating that the <code>Subject</code> represents the entity 
090     * ultimately responsible for initiating the access request.
091     *
092     * @return <code>URI</code> representing the 
093     * <code>SubjectCategory</code> of this  object.
094     */
095    public URI getSubjectCategory();
096
097    /**
098     * Sets the <code>SubjectCategory</code> of this object
099     *
100     * @param subjectCategory <code>URI</code> 
101     *
102     * @exception XACMLException if the object is immutable
103     * An object is considered <code>immutable</code> if <code>
104     * makeImmutable()</code> has been invoked on it. It can
105     * be determined by calling <code>isMutable</code> on the object.
106     */
107    public void setSubjectCategory(URI subjectCategory) throws 
108        XACMLException;
109
110   /**
111    * Returns a <code>String</code> representation of this object
112    * @param includeNSPrefix Determines whether or not the namespace qualifier
113    *        is prepended to the Element when converted
114    * @param declareNS Determines whether or not the namespace is declared
115    *        within the Element.
116    * @return a string representation of this object
117    * @exception XACMLException if conversion fails for any reason
118     */
119    public String toXMLString(boolean includeNSPrefix, boolean declareNS)
120            throws XACMLException;
121
122   /**
123    * Returns a string representation of this object
124    *
125    * @return a string representation of this object
126    * @exception XACMLException if conversion fails for any reason
127    */
128    public String toXMLString() throws XACMLException;
129
130   /**
131    * Makes the object immutable
132    */
133    public void makeImmutable();
134
135   /**
136    * Checks if the object is mutable
137    *
138    * @return <code>true</code> if the object is mutable,
139    *         <code>false</code> otherwise
140    */
141    public boolean isMutable();
142    
143}




























































Copyright © 2010-2017, ForgeRock All Rights Reserved.