ヘッダーをスキップ
Oracle® Fusion Middleware Oracle Identity Managementアプリケーション開発者ガイド
11g リリース1(11.1.1)
B56242-05
  目次へ移動
目次
索引へ移動
索引

前
 
次
 

A ユーザー・プロビジョニング用のJavaプラグイン

この付録では、Oracle Directory Integration and Provisioningプロビジョニング・サービス、リリース3.0の典型的なデプロイメントでプロビジョニング・ポリシー評価、データ検証、データ操作およびイベント配信をカスタマイズするプラグインの使用方法について説明します。

Oracleのプロビジョニング・サーバーは、デプロイメントにおけるすべてのプロビジョニング要件には対応していません。そのため、ユーザーの作成、変更および削除の様々な段階でフックが提供されます。これらのフックにより、企業では、独自のビジネス・ルールを組み入れ、各要件に合せて情報作成をカスタマイズできます。フックは、Javaプラグインの形式を取ります。

この付録では、次の項目について説明します。

A.1 プロビジョニング・プラグイン・タイプとその用途

プロビジョニング・プラグインには、次の3つのタイプがあります。

データ・エントリ・プラグインは、同期プロビジョニングまたは非同期プロビジョニングを利用するプロビジョニング・フレームワークと統合されるアプリケーションで使用されます。データ・アクセス・プラグインは、同期プロビジョニング用のプロビジョニング・フレームワークと統合されるアプリケーションでのみ使用されます。イベント配信プラグインは、非同期プロビジョニング用のプロビジョニング・フレームワークと統合されるアプリケーションでのみ使用されます。

ディレクトリのベース・ユーザー情報に影響を与えるOracleプロビジョニング・コンソール、Oracle Directory Integration and Provisioningサーバーおよびその他のメカニズムでは、情報の作成時にこれらのプラグインが起動されます。データ・エントリ・プラグインを構成することで、デプロイメントでは次の操作を実行できます。

デプロイ済のアプリケーションでアプリケーション・ユーザー情報を管理するには、そのアプリケーション用にデータ・アクセス・プラグインを構成する必要があります。このプラグイン・タイプを使用すると、ディレクトリ外部で、またはディレクトリ内部の複数エントリとしてアプリケーション情報を管理できます。

データ・エントリ・プラグインとデータ・アクセス・プラグインは、通常、次のいずれかの環境から起動されます。

イベント配信プラグインは、Javaインタフェース型を備え、プロビジョニング・イベントにサブスクライブするアプリケーションに必要です。同期プロビジョニング対応のアプリケーションには、イベント配信プラグインを実装しないでください。

A.2 プロビジョニング・プラグインの要件

アプリケーションに指定するすべてのプラグインは、標準のLDIFテンプレートでディレクトリにアップロードできるJARファイルに含まれている必要があります。サンプルは、第A.7項「プロビジョニング・プラグインの構成テンプレート」の項を参照してください。プラグイン・インタフェース定義は、$ORACLE_HOME/jlib/ldapjclnt10.jarにあります。詳細は、『Oracle Fusion Middleware Java API Reference for Oracle Internet Directory』およびパブリック・インタフェースを参照してください。アプリケーションに追加のjarファイルが必要な場合、それらのファイルもアップロードできます。

次のディレクトリにファイルを配置します。

$MW_HOME/user_projects/domains/DOMAIN_NAME/servers/MANAGED_SERVER_NAME/tmp/_WL_user/DIP_VERSION_NUMBER/RANDOM_CHARACTERS/APP-INF/lib/

A.3 データ・エントリ・プロビジョニング・プラグイン

データ・エントリ・プラグインの形式には、次の2つがあります。

これらのプラグインのいずれかを使用する場合、oracle.idm.provisioning.plugin.IdataEntryPluginインタフェースを実装する必要があります。このインタフェースには、3つのメソッドがあります。次に例を示します。

/**
   * The applications can perform a post data entry operation by
   * implementing this method.
   *
   * @param appCtx the application context
   * @param idmUser the IdmUser object
   * @param baseUserAttr Base user properties
   * @param appUserAttr App user properties
   * @throws PluginException when an exception occurs.
   */
  public PluginStatus process(ApplicationContext appCtx,
     IdmUser idmUser, ModPropertySet baseUserAttr,
       ModPropertySet appUserAttr)throws PluginException;
  /**
   * Returns the Modified Base User properties
   *
   * @return ModPropertySet modified base user properties.
   */
  public ModPropertySet getBaseAttrMods();
 
  /**
   * Returns the Modified App User properties
   *
   * @return ModPropertySet modified app user properties.
   */
  public ModPropertySet getAppAttrMods();

通常、プラグインを実装する開発者は、データ検証またはポリシー評価にこれらのメソッドを使用します。ポリシー評価の場合、ベース・ユーザー属性が評価の決定に使用されます。

アプリケーション・コンテキスト・オブジェクトには、次の情報が含まれます。

A.3.1 プレデータ・エントリ・プロビジョニング・プラグイン

プレデータ・エントリ・プラグインは、アプリケーション属性の値を生成します。アプリケーション登録時に指定された属性のデフォルト値が、現在のベース・ユーザー属性とともにこのプラグインに渡されます。Oracle Delegated Administration Servicesなどの対話的な起動環境の場合、戻り値はUIに表示されます。

プレデータ・エントリ・プラグインでは、ユーザーをアプリケーションにプロビジョニングするかどうかを決定できます。プラグインは、ベース・ユーザー属性を調査して決定を行います。プラグインは、作成操作および変更操作中に起動されます。2つの操作を1つのプラグイン・クラスでサポートするか、操作ごとに1つのクラスを割り当てることが可能です。

アプリケーションで作成操作と変更操作にプレデータ・エントリ・プラグインを使用する場合、Oracle Internet Directoryのアプリケーション・コンテナの下に2つの構成エントリを作成する必要があります。最初のエントリは、作成操作用です。

dn: cn=PRE_DATA_ENTRY_CREATE, cn=Plugins, cn=FILES, cn=Applications,
 cn=Provisioning,  cn=Directory Integration Platform, cn=Products,
 cn=OracleContext
changetype: add
objectClass: orclODIPPlugin
orclStatus: ENABLE
orclODIPPluginExecName: oracle.myapp.provisioning.UserCreatePlugin
orclODIPPluginAddInfo: Pre Data Entry Plugin for CREATE operation

2番目のエントリは、変更操作用です。

dn: cn=PRE_DATA_ENTRY_MODIFY, cn=Plugins, cn=FILES, cn=Applications,
 cn=Provisioning,  cn=Directory Integration Platform, cn=Products,
 cn=OracleContext
changetype: add
objectClass: orclODIPPlugin
orclStatus: ENABLE
orclODIPPluginExecName: oracle.myapp.provisioning.UserModifyPlugin
orclODIPPluginAddInfo: Pre Data Entry Plugin for MODIFY operation

この例では、作成プラグインと変更プラグインで別々のクラスを使用しています。

A.3.2 ポストデータ・エントリ・プロビジョニング・プラグイン

ポストデータ・エントリ・プラグインは、ユーザーがUIに入力したデータを検証します。また、導出される属性値を生成します。いずれかのアプリケーションでプラグインが失敗すると、UIの処理は停止します。ユーザー・エントリをディレクトリに作成するには、すべてのアプリケーションでデータ検証に成功する必要があります。ただし、非UI環境や自動ルーティング処理の場合、プラグインを実装する開発者は、プラグインのコール・モード(INTERACTIVE_MODEまたはAUTOMATIC_MODE)に基づいてエラーを生成するか処理を継続するかを決定できます。

プレデータ・エントリ・プラグインと同様に、ポストデータ・エントリ・プラグインも、作成操作および変更操作中に起動されます。アプリケーションでは、2つの操作を1つのプラグイン・クラスに実装するか、操作ごとに個別のクラスに実装することが可能です。

作成操作と変更操作にポストデータ・エントリ・プラグインを使用する場合、Oracle Internet Directoryのアプリケーション・コンテナの下に2つの構成エントリを作成する必要があります。最初のエントリは、作成操作用です。

dn: cn=POST_DATA_ENTRY_CREATE, cn=Plugins, cn=FILES, cn=Applications,
 cn=Provisioning,  cn=Directory Integration Platform, cn=Products,
 cn=OracleContext
changetype: add
objectClass: orclODIPPlugin
orclStatus: ENABLE
orclODIPPluginExecName: oracle.myapp.provisioning.UserMgmtPlugin
orclODIPPluginAddInfo: Post Data Entry Plugin for CREATE and MODIFY
 operations

2番目のエントリは、変更操作用です。

dn: cn=POST_DATA_ENTRY_MODIFY, cn=Plugins, cn=FILES, cn=Applications,
 cn=Provisioning,  cn=Directory Integration Platform, cn=Products,
 cn=OracleContext
changetype: add
objectClass: orclODIPPlugin
orclStatus: ENABLE
orclODIPPluginExecName: oracle.myapp.provisioning.UserMgmtPlugin
orclODIPPluginAddInfo: Post Data Entry Plugin for MODIFY and CREATE operation

この例でも、作成プラグインと変更プラグインで別々のクラスを使用しています。

A.4 データ・アクセス・プロビジョニング・プラグイン

データ・アクセス・プラグインの主な目的は、ディレクトリにあるユーザーのアプリケーション固有の情報を管理することです。このプラグインを使用して、情報を作成および取得できます。

データ・アクセス・プラグインは、ユーザーが作成されると、Oracle Delegated Administration Services、Oracle Directory Integration and Provisioningまたはバルク・プロビジョニング・ツールのいずれかによって起動され、アプリケーションに対するプロビジョニングをリクエストします。

データ・アクセス・プラグインは、変更操作および削除操作中にも起動されます。このプラグインで、アプリケーション情報を更新または削除できます。

データ・アクセス・プラグインを使用する場合、oracle.idm.provisioning.plugin.IDataAccessPluginインタフェースを実装します。このインタフェースは、次のとおりです。

   /**
    * The applications can create/modify/delete the user footprint by
    * implementing this method.
    *
    * @param appCtx the application context
    * @param idmUser IdmUser object
    * @param baseUserAttr Base user properties
    * @param appUserAttr App user properties
    *
    * @return PluginStatus a plugin status object, which must contain
    * the either <codE>IdmUser.PROVISION_SUCCESS</CODE> or
    * <codE>IdmUser.PROVISION_FAILURE</CODE> provisioning status
    *
    * @throws PluginException when an exception occurs.
    */
   public PluginStatus process(ApplicationContext appCtx,
    IdmUser idmUser, ModPropertySet baseUserAttr,
    ModPropertySet ppUserAttr) throws PluginException;
 
   /**
    * The applications can return their user footprint by
    * implementing this method. Use <CODE>
    * oracle.ldap.util.VarPropertySet </CODE>
    * as the return object
    *
    * <PRE>
    *  For Ex.
    *   PropertySet retPropertySet =  null;
    *   retPropertySet = new VarPropertySet();
    *
    *   //Fetch the App data and add it to retPropertySet
    *   retPropertySet.addProperty("name", "value");
    *   ..
    *   return retPropertySet;
    * </PRE>
    *
    * @throws PluginException when an exception occurs.
    */
   public PropertySet getAppUserData(ApplicationContext appCtx,
         IdmUser user, String reqAttrs[]) throws PluginException;

アプリケーションのユーザー情報を管理する場合、ディレクトリのアプリケーション・コンテナの下にプラグイン構成エントリを作成する必要があります。このエントリの例は、次のとおりです。

dn: cn=DATA_ACCESS, cn=Plugins, cn=FILES, cn=Applications,
 cn=Provisioning,  cn=Directory Integration Platform, cn=Products,
 cn=OracleContext
changetype: add
objectClass: orclODIPPlugin
orclStatus: ENABLE
orclODIPPluginExecName: oracle.myapp.provisioning.UserDataAccPlugin
orclODIPPluginAddInfo: Data Access Plugin

A.5 イベント配信プロビジョニング・プラグイン

イベント配信プラグインの主な用途は、Oracle Directory Integration and Provisioningサーバーによって通知されるイベントを使用することです。イベントは、Oracle Directory Integration and Provisioningサーバーによってプラグインに配信されます。イベント型と、アプリケーション・リポジトリで実行されるアクションに基づいて、必要な操作をプラグインで実行します。このプラグインのインタフェース定義は、次のとおりです。

/* $Header: IEventPlugin.java 09-jun-2005.12:45:53  *
/* Copyright (c) 2004, 2005, Oracle. All rights reserved.  */
/*
   DESCRIPTION
    All of the plug-in interfaces must extend this common interface.
   PRIVATE CLASSES
    None
   NOTES
    None
*/
package oracle.idm.provisioning.plugin;
/**
 * This is the base interface 
 */
public interface IEventPlugin
{
   /**
    * The applications can perform the initialization logic in this method.
    *
    * @param Object For now it is the provisioning Profile that is passed. 
    *        look at oracle.ldap.odip.engine.ProvProfile for more details. 
    *        
    *
    * @throws PluginException when an exception occurs.
    */
   public void initialize(Object profile) throws PluginException;
   /**
    * The applications can perform the termination logic in this method.
    *
    * @param void Provisioning Profile Object is sent. 
    *             refer to oracle.ldap.odip.engine.ProvProfile for more details
    * @throws PluginException when an exception occurs.
    */
   public void terminate(Object profile) throws PluginException;
   /**
    * Set Additional Info.
    * Since we pass on the complete profile, there is no requirement to set
    * the additiona
    * @param addInfo Plugin additional info
    */
   //public void setAddInfo(Object addInfo);
}

/* $Header: IEventsFromOID.java 09-jun-2005.12:45:53  */
/* Copyright (c) 2004, 2005, Oracle. All rights reserved.  */
/*
   DESCRIPTION
   Applications interested in receiving changes from OID should
implement this   interface. 
   PRIVATE CLASSES
    <None>
   NOTES
*/
package oracle.idm.provisioning.plugin;
import oracle.idm.provisioning.event.Event;
import oracle.idm.provisioning.event.EventStatus;

/**
 * Applications interested in receiving changes from OID should implement this
 * interface.  The applications register with the OID for the changes occurring
 * at OID. The DIP engine would instantiate an object of this class and invoke 
 * the initialize(), sendEventsToApp(), and truncate() method in the same 
 * sequence. The initialize method would provide the appropriate information 
 * from the profile in the form of a java.util.Hashtable object. 
 * The property names, that is, the hash table key that could be used by the 
 * interface implementer is defined as constants in this interface. 
 *
 * @version $Header: IEventsFromOID.java 09-jun-2005.12:45:53  $
 */
public interface IEventsFromOID extends IEventPlugin
{

   /**
    * Initialize. The application would provide any initialization logic 
    * through method. The DIP engine after instantiating a class that 
    * implements this interface will first invoke this method.
    *
    * @param prop A HashMap that would contain necessary information exposed 
    * to the applications
    * @throws EventInitializationException the applications must throw this 
    * exception in case of error.
    */
   public void initialize(Object provProfile) 
                           throws EventPluginInitException;

   /**
    * OID Events are deliverd to the application through this method.
    *
    * @param evts an array of LDAPEvent objects returned by the DIP engine
    * @return the application logc must process these events and return the 
    * status of the processed events
    * @throws EventDeliveryException the applications must throw this exception
    * in case of any error.
    */
   public EventStatus[] sendEventsToApp(Event [] evts)
                        throws EventDeliveryException;
}

/* $Header: IEventsToOID.java 09-jun-2005.12:45:53 $ */
/* Copyright (c) 2004, 2005, Oracle. All rights reserved.  */

/*
   DESCRIPTION
   Applications interested in sending changes to OID should implement this
   interface.  
*/
package oracle.idm.provisioning.plugin;
import oracle.idm.provisioning.event.Event;
import oracle.idm.provisioning.event.EventStatus;

/**
 * Applications interested in sending changes to OID should implement this
 * interface.  The applications must register with the OID for the sending 
 * changes at their  end to DIP. The DIP engine would instantiate an object 
 * of this class and invoke the initialize(), sendEventsFromApp(), and 
 * truncate() method in the same sequence. The initialize method would 
 * provide the appropriate information from the profile in the form of 
 * a java.util.Hashtable object. The property names, that is, the hash table key 
 * that could be used by the interface implementer is defined as 
 * constants in this interface. 
 *
 */
public interface IEventsToOID extends IEventPlugin
{
   /**
    * Initialize. The application would provide any initialization logic 
    * through method. The DIP engine after instantiating a class that 
    * implements this interface will first invoke this method.
    *
    * @param  prop ProvProfile 
    *              oracle.ldap.odip.engine.ProvProfile 
    * @throws EventPluginInitException the applications must throw this 
    * exception in case of error.
    */
   public void initialize(Object profile) throws EventPluginInitException;

   /**
    * Application Events are deliverd to OID through this method.
    *
    * @return an array of Event objects returned to be processed by the 
    * DIP engine.
    * @throws EventDeliveryException the applications must throw this exception
    * in case of any error.
    */
   public Event[] receiveEventsFromApp()
                        throws EventDeliveryException;

   /**
    * Application can let the DIP engine know whether there are more event to
    * follow through this method
    *
    * @return ture if there are more events to be returned and false otherwise
    * @throws PluginException the applications must throw this exception
    * in case of any error.    */
   public boolean hasMore() throws PluginException;

   /**
    * The status of the application events are intimated through this method.
    * i.e the DIP engine after processing the events calls this method to set 
    * the event status.
    *
    * @param an array of Event status objects describing the processed event
    * status by the DIP engine.
    * @throws EventDeliveryException the applications must throw this exception
    * in case of any error.
    */
   public void setAppEventStatus(EventStatus[] evtStatus)
                        throws EventDeliveryException;
}

プラグインからのディレクトリ操作を実行するには、アプリケーション・コンテキストが必要です。イベント配信プラグインのinitialize()メソッドでProvProfile.getApplicationContext()を使用して、oracle.idm.provisioning.plugin.ApplicationContextのインスタンスを取得できます。このapplicationContextを使用すると、任意のプラグイン・メソッドで任意のディレクトリ操作を実行できます。

A.6 プロビジョニング・プラグインのリターン・ステータス

各プロビジョニング・プラグインは、適切なクラスのオブジェクトを戻します。

IDataEntryPluginおよびIDataAccessPluginsはoracle.idm.provisioning.plugin.PluginStatusクラスのオブジェクトを戻します。EventDeliveryPlugins(IEventFromOIDおよびIEventToOID)は、oracle.idm.provisioning.event.EventStatusクラスのオブジェクトの配列を戻します。

戻されたオブジェクトは、successまたはfailureどちらかの実行ステータスを示します。オブジェクトはユーザー・プロビジョニング・ステータスも戻します。

A.7 プロビジョニング・プラグインの構成テンプレート

次に示すLDIFテンプレートは、Oracle Internet Directory 11gリリース1(11.1.1)でアプリケーション・プラグインを指定するために使用されます。アプリケーションのディレクトリ・エントリを作成し、プラグインを実装するクラスを含むJARファイルをアップロードする必要があります。

dn: cn=Plugins, cn=APPTYPE, cn=Applications, cn=Provisioning,
 cn=Directory Integration Platform,cn=Products,cn=OracleContext
changetype: add
add: orclODIPPluginExecData
orclODIPPluginExecData: full_path_name_of_the_JAR_file
objectclass: orclODIPPluginContainer
dn: cn=PRE_DATA_ENTRY_CREATE, cn=Plugins, cn=APPTYPE, cn=Applications,
 cn=Provisioning, cn=Directory Integration Platform, cn=Products,
 cn=OracleContext
 cn=Provisioning,  cn=Directory Integration Platform, cn=Products,
 cn=OracleContext
changetype: add
objectClass: orclODIPPlugin
orclStatus: ENABLE
orclODIPPluginExecName: Name­_of_the_class_that_implements_the_plug-in
orclODIPPluginAddInfo: Pre Data Entry Plugin for CREATE operation
dn: cn=PRE_DATA_ENTRY_MODIFY, cn=Plugins, cn=APPTYPE, cn=Applications,
 cn=Provisioning,  cn=Directory Integration Platform, cn=Products,
 cn=OracleContext
changetype: add
objectClass: orclODIPPlugin
orclStatus: ENABLE
orclODIPPluginExecName: Name­_of_the_class_that_implements_the_plug-in
orclODIPPluginAddInfo: Pre Data Entry Plugin for MODIFY operation
dn: cn=POST_DATA_ENTRY_CREATE, cn=Plugins, cn=APPTYPE, cn=Applications,
 cn=Provisioning,  cn=Directory Integration Platform, cn=Products,
 cn=OracleContext
changetype: add
objectClass: orclODIPPlugin
orclStatus: ENABLE
orclODIPPluginExecName: Name­_of_the_class_that_implements_the_plug-in
orclODIPPluginAddInfo: Post Data Entry Plugin for CREATE and modify operations
dn: cn=POST_DATA_ENTRY_MODIFY, cn=Plugins, cn=APPTYPE, cn=Applications,
 cn=Provisioning,  cn=Directory Integration Platform, cn=Products,
 cn=OracleContext
changetype: add
objectClass: orclODIPPlugin
orclStatus: ENABLE
orclODIPPluginExecName: Name­_of_the_class_that_implements_the_plug-in
orclODIPPluginAddInfo: Post Data Entry Plugin for MODIFY and CREATE operation
dn: cn=DATA_ACCESS, cn=Plugins, cn=APPTYPE, cn=Applications,
 cn=Provisioning,  cn=Directory Integration Platform, cn=Products,
 cn=OracleContext
changetype: add
objectClass: orclODIPPlugin
orclStatus: ENABLE
orclODIPPluginExecName: Name­_of_the_class_that_implements_the_plug-in
orclODIPPluginAddInfo: Data Access Plugin

dn: cn=EVENT_DELIVERY_OUT, cn=Plugins, cn=APPTYPE, cn=Applications,
 cn=Provisioning, cn=Directory Integration Platform, cn=Products, cn=OracleContext
changetype: add
objectClass: orclODIPPlugin
orclStatus: ENABLE
orclODIPPluginExecName: Name_of_the_class_that_implements_the_plug-in
orclODIPPluginAddInfo: Event Delivery Plugin for Outbound

dn: cn=EVENT_DELIVERY_IN, cn=Plugins, cn=APPTYPE, cn=Applications,
 cn=Provisioning, cn=Directory Integration Platform, cn=Products, cn=OracleContext
changetype: add
objectClass: orclODIPPlugin
orclStatus: ENABLE
orclODIPPluginExecName: Name_of_the_class_that_implements_the_plug-in
orclODIPPluginAddInfo: Event Delivery Plugin for Inbound

A.8 プロビジョニング・プラグインのサンプル・コード

/* Copyright (c) 2004, Oracle. All rights reserved. */
/**
 DESCRIPTION
 Sample PRE DATA Entry Plugin for CREATE operation that
 validates the attribute.
 PRIVATE CLASSES
 None.
 NOTES
 This class implements the PRE_DATA_ENTRY_CREATE plugin ONLY
 MODIFIED (MM/DD/YY)
 12/15/04 \226 Creation
*/
package oracle.ldap.idm;
 
import java.util.*;
import javax.naming.*;
import javax.naming.ldap.*;
import javax.naming.directory.*;
import oracle.ldap.util.*;
import oracle.idm.provisioning.plugin.*;
/**
 * This class implements the PRE_DATA_ENTRY_CREATE plugin ONLY
 *
 */
public class SamplePreDataEntryCreatePlugin implements IDataEntryPlugin
{
   public ModPropertySet mpBaseUser = null;
   public ModPropertySet mpAppUser = null;
 
   public PluginStatus process(ApplicationContext appCtx,IdmUser idmuser,
    ModPropertySet baseUserAttr, ModPropertySet appUserAttr)
          throws PluginException
   {
     PluginStatus retPluginStatus = null;
     String retProvStatus = null;
     String retProvStatusMsg = null;
 
     LDIFRecord lRec = null;
     LDIFAttribute lAttr = null;
     String val = null;
     if(null == baseUserAttr.getModPropertyValue(\223departmentNumber\224))
     {
        mpBaseUser = new ModPropertySet();
        mpBaseUser.addProperty("departmentNumber","ST");
        appCtx.log(\223Base user attribute \226 departmentNumber missing\224 +
               \223Setting default - ST\224);
     }
     else if ( baseUserAttr.getModPropertyValue(\223departmentNumber\224)
                .notIn(\223ST\224, \223APPS\224, \224CRM\224) )
     {
        throw new PluginException(\223Invalid department Number\224);
     }
     if((null == appUserAttr) ||
               null == appUserAttr.getModPropertyValue(\223emailQouta\224))
     {
        mpAppUser = new ModPropertySet();
        mpAppUser.addProperty("emailQouta","50M");
        appCtx.log(\223Application user attribute - email Qouta missing \224 +
            \223Setting default - 50M\224);
     }
     return new PluginStatus(PluginStatus.SUCCESS, null, null);
  }
 
  public ModPropertySet getBaseAttrMods()
  {
    return mpBaseUser;
  }
 
  public ModPropertySet getAppAttrMods()
  {
    return mpAppUser;
  }
}
/* Copyright (c) 2004, Oracle. All rights reserved. */
/**
 DESCRIPTION
 Sample POST DATA Entry Plugin for CREATE operation. Implementing a
 policy check to provision only those users who belong to \223SALES\224.
 PRIVATE CLASSES
 None.
 NOTES
 This class implements the POST_DATA_ENTRY_CREATE plugin ONLY
 MODIFIED (MM/DD/YY)
 12/15/04 \226 Creation
*/
package oracle.ldap.idm;
 
import java.util.*;
import javax.naming.*;
import javax.naming.ldap.*;
import javax.naming.directory.*;
import oracle.ldap.util.*;
import oracle.idm.provisioning.plugin.*;
/**
 * This class implements the POST_DATA_ENTRY_CREATE plugin ONLY
 *
 */
public class SamplePostDataEntryCreatePlugin implements IDataEntryPlugin
{
   public ModPropertySet mpBaseUser = null;
   public ModPropertySet mpAppUser = null;
 
   public PluginStatus process(ApplicationContext appCtx,IdmUser idmuser,
    ModPropertySet baseUserAttr, ModPropertySet appUserAttr)
          throws PluginException
   {
     PluginStatus retPluginStatus = null;
     String retProvStatus = null;
     String retProvStatusMsg = null;
 
     if(null == baseUserAttr.getModPropertyValue(\223deptartmentNumber\224))
     {
        mpBaseUser = new ModPropertySet();
        mpBaseUser.addProperty("deptartmentNumber ","SALES");
        appCtx.log("Base user attribute \221c\222 is missing");
 
        retProvStatus = IdmUser.PROVISION_ REQUIRED;
        retProvStatusMsg =  "Provision policy: Only \221SALES\222\224.
     }
     else if (baseUserAttr.getModPropertyValue(\223deptartmentNumber\224)
             .equals(\223SALES\224))
     {
        retProvStatus = IdmUser.PROVISION_ REQUIRED;
        retProvStatusMsg =  "Provision policy: Only \221SALES\222\224.
     }
     else
     {
        // do not provision those users who do not belong to SALES.
        retProvStatus = IdmUser.PROVISION_NOT_REQUIRED;
        retProvStatusMsg =
                "Do not provision the person who is not from \221SALES\222";
      }
 
      return new PluginStatus(PluginStatus. SUCCESS, retProvStatusMsg,
                                   retProvStatus);
  }
 
  public ModPropertySet getBaseAttrMods()
  {
    return mpBaseUser;
  }
 
  public ModPropertySet getAppAttrMods()
  {
    return mpAppUser;
  }
}
/* Copyright (c) 2004, Oracle. All rights reserved. */
/**
 DESCRIPTION
 Sample DATA Access Plugin.
 NOTES
 This class implements the DATA_ACCESS plugin
 MODIFIED (MM/DD/YY)
 12/15/04 \226 Creation
*/
package oracle.ldap.idm;
 
import javax.naming.*;
import javax.naming.ldap.*;
import javax.naming.directory.*;
import oracle.ldap.util.*;
import oracle.idm.provisioning.plugin.*;
/**
 * This class implements the DATA_ACCESS plugin ONLY
 *
 */
public class SampleDataAccessPlugin implements IDataAccessPlugin
{
   public PluginStatus process(ApplicationContext appCtx,IdmUser idmuser,
        ModPropertySet baseUserAttr,ModPropertySet appUserAttr)
            throws PluginException
   {
      try {
          DirContext dirCtx = appCtx.getDirCtx();
          if ( appCtx.getCallOp().equals(ApplicationContext.OP_CREATE )
          {
            // Use the directory context and create the entry.
          }
          elseif ( appCtx.getCallOp().equals(ApplicationContext.OP_MODIFY)
          {
            // Use the directory context and modify the entry.
          }
      } catch (Exception e) {
         throw new PluginException(e);
      }
      return new PluginStatus(PluginStatus.SUCCESS, null, null);
   }
 
   public PropertySet getAppUserData(ApplicationContext appCtx,
          IdmUser idmuser, String [] reqAttrs) throws PluginException
   {
      VarPropertySet vpSet = null;
      DirContext dirCtx = appCtx.getDirCtx();
 
      try {
        Attributes attrs= dirCtx.getAttributes(\223myAppContainer\224);
        vpSet = new VarPropertySet(); // Populate the VarPropertySet from attrs
      } catch(Exception ne) {
        throw new PluginException(e);
      }
      return vpSet;   }
}