Oracle® Fusion Middleware OES-11g Release 2 (11.1.2.2.0)- How to configure custom Attribute Retriever
Create a java code, convert to a jar, and add it to the CLASSPATH.
Here is the sample of custom attribute retriever:
import com.bea.security.providers.authorization.asi.AttributeRetriever;
import weblogic.security.spi.Resource;
import weblogic.security.service.ContextHandler;
import javax.security.auth.Subject;
import java.util.*;
import java.io.*;
public class MyAttributeRetriever implements AttributeRetriever {
private static final String TestCustomAttribute = "TestCustomAttribute";
private String[] attributes = {"TestCustomAttribute"};
private static boolean switchStatus = true;
public String[] getHandledAttributeNames() {
return attributes;
}
public Object getAttributeValue(String name,Subject subject,Map roles,Resource resource,ContextHandler contextHandle) {
ArrayList listValues = new ArrayList();
String attrValue = "default";
if (name.equals("TestCustomAttribute")) {
System.out.println("Name"+name);
attrValue = "TestCustomAttribute";
System.out.println( "attrValue value is TestCustomAttribute "); }
else { System.out.println( "attrValue value is NotTestCustomAttribute "); }
return attrValue;}
Modify jps-config.xml, located in the Security Module
For Example:
<serviceProvider class="oracle.security.jps.az.internal.runtime.provider.PIPServiceProvider" name="pip.service.provider" type="PIP"/>
<serviceInstance name="pip.service.MyAttributeRetriever" provider="pip.service.provider"><property name="type" value="CUSTOM_PIP"/>
<property name="application" value="TestCustomAttribute"/>
<property name="description" value="MyAttributeRetriever"/>
<property name="classnames" value="com.mindtelligent.oes.customproviders.MyAttributeRetriever"/>
</serviceInstance>
<serviceInstanceRef ref="pip.service.MyAttributeRetriever"/>