Tuesday, July 1, 2014

Oracle® Fusion Middleware OES-11g Release 2 ( How to configure custom Attribute Retriever

Oracle® Fusion Middleware OES-11g Release 2 ( 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:

package com.mindtelligent.oes.customproviders;
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")) {
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"/>
<serviceInstanceRef ref="pip.service.MyAttributeRetriever"/>

No comments:

Post a Comment

SOA Cloud 12c GIT Repository

When a project is created, you can choose to initialize the project with one project Git repository for the project. A Maven repository is a...