FROM THE BLOG

ADF Tips: OPSS User and Role API – Part 3; Create a user.

Hi again, this is the third post related to OPSS User and Role API which basically will show how to simply create a user in the weblogic server authenticator. If you haven’t seen the previous posts please see here Part 1 and Part 2.

Let’s the screenshots speak up by themselves. First thing is to have a look to our weblogic’s security realms;

OPSS_ADF_ADD_USER_17

Authenticator provider

OPSS_ADF_ADD_USER_18

 

And Users from our DefaultAuthenticator;

OPSS_ADF_ADD_USER_1

 

Now, in our ADF application we have created added a new method to be exposed through our POJO DC:

OPSS_ADF_ADD_USER_12

Now we can proceed to create a new user;

OPSS_ADF_ADD_USER_2

Click Save and see the result in the weblogic server;

OPSS_ADF_ADD_USER_4

 

You can also retrieve this list from your adf application as showed in Part 1;

OPSS_ADF_ADD_USER_3

 

Now. What happened if we decided to use OID as our authenticator provider? let’s have a look how to create a user in OID following the same approach. We now configure OID as our authenticator provider; add a new OID Authenticator (Please note that I wont be showing how to configure the provider specifics. I will asume you will or have read other posts related to how to do this);

OPSS_ADF_ADD_USER_5

 

OPSS_ADF_ADD_USER_14

 

We now need to reorder the list and put out OIDProvider first on the list;

OPSS_ADF_ADD_USER_6

OPSS_ADF_ADD_USER_15

And finally we need to change its flag to SUFFICIENT;

OPSS_ADF_ADD_USER_7

(You might need to do the same for DefaultAuthenticator). Now, we restart the WLS and run our application. We first check the users and make sure its bringing the OID ones. (I have cropped the information since its not my personal environment).

OPSS_ADF_ADD_USER_8

 

Now, we go again to our create user form and create a new user;

OPSS_ADF_ADD_USER_10

Querying the users we can confirm the new __Test user has been created, this time we queried it directly in the Weblogic console;

OPSS_ADF_ADD_USER_11

And the most important part; what code did we use? This;

OPSS_ADF_ADD_USER_12

No. I did not mistake the picture. It uses the same method, the same piece of code that the previous example and in fact, we did not have to modify a thing in the code. That is how OPSS abstraction is exercised. However, you probably may need to customize your code if you need to apply different rules or logic depending in what is your authProvider. I haven’t had time to test, but there is a open debate on whether this won’t work if you are using a SQLAuthenticator. As soon as I get my hands into it and get some results I will posting an update.

 

 

5 comments

  1. Florin Marcus

    on

    Reply

    OPSS User and Roles API doesn’t support SQLAuthentication Provider for user and roles maintenance.
    Therefore, the main statement behind OPSS:

    “Oracle Platform Security Services (OPSS) provides enterprise product development teams, systems integrators (SIs), and independent software vendors (ISVs) with a standards-based, portable, integrated, enterprise-grade security framework for Java Standard Edition (Java SE) and Java Enterprise Edition (Java EE) applications.”

    might raise few eyebrows, since it only supports the below providers:

    Microsoft Active Directory
    Novell EDirectory
    Sun Java System Directory Server
    Oracle Internet Directory
    Oracle Virtual Directory
    OpenLDAP
    Oracle WebLogic Server Embedded LDAP Directory

  2. Sandy P

    on

    Reply

    These OPSS examples are really helpful, can you tell me which package to import for the class: IdentityStoreServiceFactory.getIdentityStoreInstance()? Thanks.

  3. Sandy P

    on

    Reply

    IdentityStoreServiceFactory class is used in Create User usecase – fyi.

    • Abhi

      on

      Reply

      Hi,

      Can you please tell me which library required to import class IdentityStoreServiceFactory ?
      which package?

  4. joe

    on

    Reply

    Hi, could you provide how to check username availability method? since every username in OPSS are unique, thank you..

Leave a comment

Your email address will not be published. Required fields are marked *

Social Media

Stay up-to-date with our latest ADF and related technical posts via your favourite social network services.