Security IntegrationThis is a featured page

Q: I have a custom security user provider. I've created the class:
public class CustomAuthProvider implements ProviderInterface, UserProvider
I've overridden the checkCredentials() method.
public void checkCredentials(UserData userData, DataBinder inBinder, boolean isLoadAttributes) throws ServiceException
I now want to add a role to the user and I want to add additional attributes. The additional attributes are out of the box user metadata fields like email and custom user metadata fields, like department.

A:


This page attempts to document doing a security integration with UCM.

If you want to use a different source for user information (username, password, information(email,etc), and security info (roles, accounts)), then you can create a user provider.

User Provider Notes:

1.
Create a user provider component.

2.
public class YourClassName implements ProviderInterface, UserProvider {
private Provider m_provider = null;

3.
public void init(Provider provider) throws DataException {
m_provider = provider;
}

public void checkCredentials(UserData userData, DataBinder inBinder,
boolean isLoadAttributes) throws ServiceException {
// DataBinder pdatabinder = m_provider.getProviderData();
boolean authenticateUser = StringUtils.convertToBool(inBinder
.getLocal("authenticateUser"), false);

if ( ! authenticateUser ) {
return;
}
String uid = userData.m_name;
String password = password = inBinder.getActiveValue("userPassword");
boolean userHasAuthenticated = StringUtils.convertToBool(inBinder
.getLocal("hasAuthenticatedUser"), false);

if (!userHasAuthenticated) {
boolean userauthorized = // CODE HERE TO VALIDATE USER.

inBinder.putLocal("hasAuthenticatedUser", (userauthorized) ? "true"
: "false");
inBinder.putLocal("SourcePath", "");
userData.setProperty("lastLoadedTs", String.valueOf(System
.currentTimeMillis()));
}

Environment:
Oracle Enterprise Linux 5U2. UCM 10gR3. Oracle 10g Database. Apache.

first off get a gcc compiler for you linux distro. Maybe add the follow lines to /etc/yum.conf:

[EL5.2 DVD]
name = Enterprise Linux 5.2 DVD
baseurl=http://10.187.68.68/~fentontravers/el5dvd/Server/
gpgcheck=1
enabled=1

this assumes you've got the linux os extracted to the URL above.

then do a :

yum install gcc

This will install the gcc compiler.


abhi.garg
abhi.garg
Latest page update: made by abhi.garg , Dec 21 2008, 9:20 PM EST (about this update About This Update abhi.garg Took the question about adding additional attributes out of the main wiki article and posted it as a thread - abhi.garg

76 words deleted

view changes

- complete history)
Keyword tags: None
More Info: links to this page
Started By Thread Subject Replies Last Post
abhi.garg Further customisation of User Provider 0 Dec 21 2008, 9:19 PM EST by abhi.garg
Thread started: Dec 21 2008, 9:19 PM EST  Watch
We have used the above code to access an external provider. The code creates a user record in the "User" table programatically after authenticating the user against the external database.

Currently the olny column in the table being populated is "DUSER" which is the username. We wish to also add other attributes such as DEMAIL, DFULLNAME. We would also like to add a role to the user programatically.

Any help will be appreciated.

Khush
Do you find this valuable?    
Showing 1 of 1 threads for this page