001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2008 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: ResourceAttribute.java,v 1.1 2009/08/19 05:40:33 veiming Exp $
026 */
027
028/*
029 * Portions copyright 2010-2014 ForgeRock AS.
030 */
031
032package com.sun.identity.entitlement;
033
034import java.util.Map;
035import java.util.Set;
036import javax.security.auth.Subject;
037
038/**
039 * Encapsulates a Strategy to derive attributes to be returned with a particular
040 * {@link com.sun.identity.entitlement.Entitlement} when evaluating {@link com.sun.identity.entitlement.Privilege}s.
041 *
042 * For example, these may be statically defined ({@link com.sun.identity.entitlement.StaticAttributes})
043 * or derived from the {@link Subject}'s account details ({@link com.sun.identity.entitlement.UserAttributes}).
044 *
045 * @supported.all.api
046 */
047public interface ResourceAttribute {
048
049    /**
050     * Sets property name.
051     *
052     * @param name property name.
053     */
054    void setPropertyName(String name);
055
056    /**
057     * Returns property name.
058     *
059     * @return name property name.
060     */
061    String getPropertyName();
062
063    /**
064     * Returns property values.
065     *
066     * @return properties for this <code>ResourceAttribute</code>.
067     */
068    Set<String> getPropertyValues();
069
070    /**
071     * Returns resource attributes applicable to the request.
072     *
073     * @param adminSubject Subject who is performing the evaluation.
074     * @param realm Realm name.
075     * @param subject Subject who is under evaluation.
076     * @param resourceName Resource name.
077     * @param environment Environment parameters.
078     * @return applicable resource attributes.
079     * @throws EntitlementException if a condition decision cannot be reached.
080     */
081    Map<String, Set<String>> evaluate(
082        Subject adminSubject,
083        String realm,
084        Subject subject,
085        String resourceName,
086        Map<String, Set<String>> environment)
087        throws EntitlementException;
088
089    /**
090     * Sets OpenSSO policy response provider name of the object.
091     *
092     * @param pResponseProviderName response provider name as used in OpenSSO policy, this is relevant only
093     *        when StaticAttributes was created from OpenSSO policy Subject
094     *
095     * @deprecated
096     */
097    @Deprecated
098    void setPResponseProviderName(String pResponseProviderName);
099
100    /**
101     * Returns OpenSSO policy response provider name of the object
102     *
103     * @return response provider name as used in OpenSSO policy, this is relevant only when StaticAttributes
104     *         were created from OpenSSO policy Subject
105     *
106     * @deprecated
107     */
108    @Deprecated
109    String getPResponseProviderName();
110
111    /**
112     * Returns state of the object encoded as a JSON string.
113     *
114     * @return state of the object encoded as a JSON string.
115     */
116    String getState();
117
118    /**
119     * Sets state of this object from a JSON string.
120     *
121     * @param state State of the object encoded as a JSON string
122     */
123    void setState(String state);
124}




























































Copyright © 2010-2017, ForgeRock All Rights Reserved.