001/** 002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 003 * 004 * Copyright (c) 2006 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: ResponseProvider.java,v 1.5 2008/08/19 19:09:16 veiming Exp $ 026 * 027 * Portions Copyrighted 2014 ForgeRock AS. 028 */ 029 030 031 032package com.sun.identity.policy.interfaces; 033 034import com.sun.identity.policy.PolicyException; 035import com.sun.identity.policy.Syntax; 036import com.iplanet.sso.SSOToken; 037import com.iplanet.sso.SSOException; 038 039import java.util.List; 040import java.util.Locale; 041import java.util.Map; 042import java.util.Set; 043 044/** 045 * The class <code>ResponseProvider</code> defines an interface to allow 046 * pluggable response providers into the OpenSSO framework. These 047 * are used to provide policy response attributes. Policy response attributes 048 * are different from <code>ActionDecision</code>. Policy response attributes 049 * typically provide attribute values of user profile. User profile could 050 * exist in any data store managed by Identity repository. However, reponse 051 * attributes are not restricted to attributes from user profile. 052 * Source of the attribute values is completely at the discretion of the 053 * specific implementation of the <code>ResponseProvider</code>. 054 * <p> 055 * The response provider is initialized by calling its <code>initialize() 056 * </code> method. 057 * Its also configured by setting its properites by a call to 058 * <code>setProperties()</code> method. 059 * <p> 060 * Response attribute names are not checked against schema of the service 061 * registered with OpenSSO. (<code>ActionDecision</code> attributes 062 * are checked against the schema of the service registered with 063 * OpenSSO). 064 * 065 * A Response Provider computes a <code>Map</code> of response attributes 066 * and their values based on the <code>SSOToken</code>, resource name and 067 * environment <code>Map</code> passed in the method call 068 * <code>getResponseDecision()</code>. 069 * 070 * Policy framework would make a call <code>getResponseDecision</code> from the 071 * <code>ResponseProvider</code>(s) associated with a policy only if the 072 * policy is applicable to a request as determined by <code>SSOToken</code>, 073 * <code>resource name</code>, <code>Subjects</code> and 074 * <code>Conditions</code>. 075 * <p> 076 * The only out-of-the-box <code>ResponseProvider</code> implementation 077 * provided with the Policy framework would be 078 * <code>IDRepoResponseProvider</code>. 079 * 080 * All <code>ResponseProvider</code> implementations should have a public no 081 * argument constructor. 082 * @supported.all.api 083 * @deprecated since 12.0.0, use {@link com.sun.identity.entitlement.ResourceAttribute} 084 */ 085@Deprecated 086public interface ResponseProvider extends Cloneable { 087 088 /** 089 * Initialize the <code>ResponseProvider</code> 090 * @param configParams <code>Map</code> of the configurational information 091 * @exception PolicyException if an error occured during 092 * initialization of the instance 093 */ 094 095 public void initialize(Map configParams) throws PolicyException; 096 097 098 /** 099 * Returns a list of property names for the Response provider. 100 * 101 * @return list of property names 102 */ 103 public List getPropertyNames(); 104 105 /** 106 * Returns the syntax for a property name 107 * @see com.sun.identity.policy.Syntax 108 * 109 * @param property property name 110 * 111 * @return <code>Syntax<code> for the property name 112 */ 113 public Syntax getPropertySyntax(String property); 114 115 116 /** 117 * Gets the display name for the property name. 118 * The <code>locale</code> variable could be used by the plugin to 119 * customize the display name for the given locale. 120 * The <code>locale</code> variable could be <code>null</code>, in which 121 * case the plugin must use the default locale. 122 * 123 * @param property property name 124 * @param locale locale for which the property name must be customized 125 * @return display name for the property name. 126 * @throws PolicyException 127 */ 128 public String getDisplayName(String property, Locale locale) 129 throws PolicyException; 130 131 /** 132 * Returns a set of valid values given the property name. This method 133 * is called if the property <code>Syntax</code> is either the 134 * <code>SINGLE_CHOICE</code> or <code>MULTIPLE_CHOICE</code>. 135 * 136 * @param property <code>String</code> representing property name 137 * @return Set of valid values for the property. 138 * @exception PolicyException if unable to get the <code>Syntax</code>. 139 */ 140 public Set getValidValues(String property) throws 141 PolicyException; 142 143 /** Sets the properties of the responseProvider plugin. 144 * This influences the response attribute-value Map that would be 145 * computed by a call to method <code>getResponseDecision(Map)</code> 146 * These attribute-value pairs are encapsulated in 147 * <code>ResponseAttribute</code> element tag which is a child of the 148 * <code>PolicyDecision</code> element in the PolicyResponse xml 149 * if the policy is applicable to the user for the resource, subject and 150 * conditions defined. 151 * @param properties the properties of the <code>ResponseProvider</code> 152 * Keys of the properties have to be String. 153 * Value corresponding to each key have to be a <code>Set</code> 154 * of String elements. Each implementation of ResponseProvider 155 * could add further restrictions on the keys and values of this 156 * map. 157 * @throws PolicyException for any abnormal condition 158 */ 159 public void setProperties(Map properties) throws PolicyException; 160 161 /** Gets the properties of the response provider. 162 * @return properties of the response provider. 163 * @see #setProperties 164 */ 165 public Map getProperties(); 166 167 /** 168 * Gets the response attributes computed by this ResponseProvider object, 169 * based on the <code>SSOToken</code> and <code>Map</code> of 170 * environment parameters. 171 * 172 * @param token single-sign-on token of the user 173 * 174 * @param env request specific environment map of key/value pairs 175 * @return a <code>Map</code> of response attributes. 176 * Keys of the Map are attribute names of type <code>static</code> 177 * and <code>dynamic</code>. 178 * Value is a <code>Set</code> of response attribute values 179 * (<code>String</code>). 180 * 181 * @throws PolicyException if the decision could not be computed 182 * @throws SSOException <code>token is not valid 183 * 184 */ 185 public Map getResponseDecision(SSOToken token, 186 Map env) throws PolicyException, SSOException; 187 188 /** 189 * Returns a copy of this object. 190 * 191 * @return an <code>Object</code> which is a copy of this object 192 */ 193 public Object clone(); 194 195}
Copyright © 2010-2017, ForgeRock All Rights Reserved.