Weblogic Server, by default stores the user and group information in an Embedded LDAP Server.
If we want to store the user and group information in a database, Weblogic Server provides an Out of the Box Provider, SQL Authenticator.
The SQL Authenticator uses a default schema, which can be modified.
To create the tables required by the SQL Authenticator using the default schema, execute the following query.
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
Insert the User and Group records into the database.
insert into USERS (U_NAME,U_PASSWORD,U_DESCRIPTION) values(’system’,’weblogic’,’admin user’);
insert into GROUPS (G_NAME,G_DESCRIPTION) values(‘Adminsitrators’,’Adnministrators’);
insert into GROUPMEMBERS (G_NAME,G_MEMBER) values(‘Administrators’,’system’);
Create a datasource on Weblogic Server.
Create an SQLAuthenticator
myrealm > Providers > new SQLAuthenticator
Under myrealm > Providers > SQLAuthenticator > Provider Specific
Check Plaintext Passwords Enabled
Data Source Name: DS1
Leave the rest as default since we are using default schema.
In my example I have used plain text password.
If you want to log in to the console from users in the database, change the default authenticator flag as OPTIONAL.
Restart the server and log in as system.
Go to myrealm > Users and Groups to see the user and groups from the database.
Hi FaisalIs there an api that lets you programmatically add users?
Yes you can do it using UserEditorMbeanhttp://download.oracle.com/docs/cd/E15051_01/wls/docs103/javadocs/weblogic/management/security/authentication/UserEditorMBean.htmlPlease find a sample below.http://secure-zone.blogspot.com/2009/10/creating-users-in-weblogic-server.html
thanks a lot Faisal you were a big help. Many thanks
Awesome document, thanks a ton 🙂
Regards,
Arunbaalajee R
Nice document except for the typos. The ‘insert into groups’ command is wrong.
thanks for pointing out mark…
I created users and groups in database following the above steps. All are listed in the myrealm in the WebLogic console.
I could NOT see the users and groups in the Oracle BPM Workspace, while doing a ‘reassign’ for any task, please advice.
Not sure, you can post on Oracle BPM forum..
I could not logon to Workspace with the database users
You will have to modify the default roles and policies in order to do that..
https://weblogic-wonders.com/weblogic/2010/06/04/how-to-modify-weblogic-default-roles-and-policies/
Hi,
I am trying to configure SQLAuthenticator Provide in weblogic 11g but getting following exception defined data source is configured through Wallet. any help in this regard?
com.bea.common.engine.ServiceInitializationException: java.lang.NullPointerException
at com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:365)
at com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:315)
at com.bea.common.engine.internal.ServiceEngineImpl.lookupService(ServiceEngineImpl.java:257)
at com.bea.common.engine.internal.ServicesImpl.getService(ServicesImpl.java:72)
at weblogic.security.service.internal.WLSIdentityServiceImpl.initialize(WLSIdentityServiceImpl.java:47)
at weblogic.security.service.CSSWLSDelegateImpl.initializeServiceEngine(CSSWLSDelegateImpl.java:300)
at weblogic.security.service.CSSWLSDelegateImpl.initialize(CSSWLSDelegateImpl.java:222)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.InitializeServiceEngine(CommonSecurityServiceManagerDelegateImpl.java:1784)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initializeRealm(CommonSecurityServiceManagerDelegateImpl.java:445)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.loadRealm(CommonSecurityServiceManagerDelegateImpl.java:840)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initializeRealms(CommonSecurityServiceManagerDelegateImpl.java:870)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initialize(CommonSecurityServiceManagerDelegateImpl.java:1030)
at weblogic.security.service.SecurityServiceManager.initialize(SecurityServiceManager.java:881)
at weblogic.security.SecurityService.start(SecurityService.java:142)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused By: java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:396)
at java.util.Properties.setProperty(Properties.java:143)
at weblogic.security.service.internal.DataSourceManager.getDirectConnection(DataSourceManager.java:394)
at weblogic.security.service.internal.DataSourceManager.getConnection(DataSourceManager.java:351)
at weblogic.security.service.internal.NamedSQLConnectionLookupServiceImpl.getConnection(NamedSQLConnectionLookupServiceImpl.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.security.service.internal.Delegator$MyInvocationHandler.invoke(Delegator.java:49)
at $Proxy13.getConnection(Unknown Source)
at weblogic.security.providers.authentication.DBMSDatabaseConnectionPoolImpl.getRawConnection(DBMSDatabaseConnectionPoolImpl.java:131)
at weblogic.security.providers.authentication.DBMSSQLDatabaseConnectionPoolImpl.checkoutConnection(DBMSSQLDatabaseConnectionPoolImpl.java:25)
at weblogic.security.providers.authentication.DBMSSQLAuthenticatorDelegateImpl.getManageableConnection(DBMSSQLAuthenticatorDelegateImpl.java:918)
at weblogic.security.providers.authentication.DBMSSQLAuthenticatorDelegateImpl.validateConfiguration(DBMSSQLAuthenticatorDelegateImpl.java:153)
at weblogic.security.providers.authentication.DBMSSQLAuthenticatorDelegateImpl.(DBMSSQLAuthenticatorDelegateImpl.java:78)
at weblogic.security.providers.authentication.DBMSAuthenticatorDelegateImpl.getInstance(DBMSAuthenticatorDelegateImpl.java:459)
at weblogic.security.providers.authentication.DBMSSQLAuthenticationProviderImpl.initialize(DBMSSQLAuthenticationProviderImpl.java:55)
at com.bea.common.security.internal.legacy.service.SecurityProviderImpl.init(SecurityProviderImpl.java:65)
at com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:363)
at com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:315)
at com.bea.common.engine.internal.ServiceEngineImpl.lookupService(ServiceEngineImpl.java:257)
at com.bea.common.engine.internal.ServicesImpl.getService(ServicesImpl.java:72)
at weblogic.security.service.internal.WLSIdentityServiceImpl.initialize(WLSIdentityServiceImpl.java:47)
at weblogic.security.service.CSSWLSDelegateImpl.initializeServiceEngine(CSSWLSDelegateImpl.java:300)
at weblogic.security.service.CSSWLSDelegateImpl.initialize(CSSWLSDelegateImpl.java:222)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.InitializeServiceEngine(CommonSecurityServiceManagerDelegateImpl.java:1784)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initializeRealm(CommonSecurityServiceManagerDelegateImpl.java:445)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.loadRealm(CommonSecurityServiceManagerDelegateImpl.java:840)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initializeRealms(CommonSecurityServiceManagerDelegateImpl.java:870)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initialize(CommonSecurityServiceManagerDelegateImpl.java:1030)
at weblogic.security.service.SecurityServiceManager.initialize(SecurityServiceManager.java:881)
at weblogic.security.SecurityService.start(SecurityService.java:142)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
>