Wednesday, January 18, 2017

SQLAuthenticator Provider Configuration Demo With Weblogic

By default Users & Groups information's are managed using weblogic DefaultAuthenticator ie. Embedded LDAP. To manage application specific Users and Groups in efficient manner these information's will be stored in external LDAP like SQLAuthenticator, Active Directory, OID etc.


Step 1) Create Data Source sqlds which will used for while configuring SQLAuthenticator


Login to wls console ==> Click on Services ==> Click on Data Sources ==> Click on New ==>Click on Generic Data sources ==> Create sqlds datasource



Step 2) Create the following Tables "USERS", "GROUPS" and "GROUPMEMBERS" by running below sql queries



CREATE TABLE USERS (
    U_NAME VARCHAR(200) NOT NULL,
    U_PASSWORD VARCHAR(50) NOT NULL,
    U_DESCRIPTION VARCHAR(1000));
ALTER TABLE USERS
   ADD CONSTRAINT PK_USERS
   PRIMARY KEY (U_NAME);
   
CREATE TABLE GROUPS (
    G_NAME VARCHAR(200) NOT NULL,
    G_DESCRIPTION VARCHAR(1000) NULL);
ALTER TABLE GROUPS
   ADD CONSTRAINT PK_GROUPS
   PRIMARY KEY (G_NAME);
   
CREATE TABLE GROUPMEMBERS (
    G_NAME VARCHAR(200) NOT NULL,
    G_MEMBER VARCHAR(200) NOT NULL);
ALTER TABLE GROUPMEMBERS
   ADD CONSTRAINT PK_GROUPMEMS
   PRIMARY KEY (
      G_NAME,
      G_MEMBER
   );
   
ALTER TABLE GROUPMEMBERS
   ADD CONSTRAINT FK1_GROUPMEMBERS
   FOREIGN KEY ( G_NAME )
   REFERENCES GROUPS (G_NAME)
   ON DELETE CASCADE;

Step 3) Insert the following records in the Above Tables.


insert into USERS  values('jagan','welcome1','username is jagan stored in sqlauthenticator');

insert into GROUPS values('Administrators','This is an Administrators Group');

insert into GROUPMEMBERS values('Administrators','jagan');


Step 4) Create SQLAuthenticator authentication provider


Login to wls console ==> click on "Security Realms" ==> Click on "myrealm" ==> Click on Providers ==> Click on New ==> Enter Name "TestSQLAuthenticator" ==> Select Type SQLAuthenticator ==> Click on OK


Step 5) Configure SQLAuthenticator  provider


Click on newly created SQLAuthenticator ==> Click Configuration ==> Click on Provider Specific ==> Check the check box "Plaintext Passwords Enabled" ==> Enter data source name sqlds ==> Click on Save



Step 6) Setting Control Flag for SQLAuthenticator 


Click on newly created SQLAuthenticator ==> Click Configuration  ==> Click on Common ==> Control Flag OPTIONAL ==> Save



Step 7) Setting Control Flag for DefaultAuthenticator 


Go to Providers table ==> Click on DefaultAuthenticator ==> Click Configuration  ==> Click on Common ==> Control Flag OPTIONAL ==> Save




Step 8) Reorder providers


Go back to providers table ==> Click on Reorder ==> Select TestSQLAuthenticator ==> By using up arrows keep this provider at the Top ==> Click on OK





Step 9) Restart AdminServer


cd /oracle/Middleware/user_projects/domains/base_domain/bin
 ./stopWebLogic.sh

nohup ./startWebLogic.sh &

Step 10) Now login to Weblogic console using SQLAuthenticator user  jagan







No comments:

Post a Comment