OIM 11G - CSF Security Store Map and Code to extract credential

In this post, I will talk about how to use the jps api to read CSF key and then how to use that in SOA Composite

Go to EM console. Login as weblogic.
Expand Weblogic Domain in left pane.
Right click on <WLS_DOMAIN>. Select Security Credentials.
Click on “Create Map” button. Provide name for map as “PasswordMap”. Click OK.
Click on “Create Key” button. Provide following details:

Select Map: PasswordMap
Key: xladminkey
Type: Password
Username: xelsysadm
Password: < xelsysadm’s password> Click OK.

and Code to read the credentials

            String oimUserName = "";
            String oimPassword = "";
            oracle.security.jps.JpsContext ctx = oracle.security.jps.JpsContextFactory.getContextFactory().getContext();
            final oracle.security.jps.service.credstore.CredentialStore cs = (oracle.security.jps.service.credstore.CredentialStore) ctx
                    .getServiceInstance(oracle.security.jps.service.credstore.CredentialStore.class);
            oracle.security.jps.service.credstore.CredentialMap cmap = cs.getCredentialMap("PasswordMap");
            oracle.security.jps.service.credstore.Credential cred = cmap.getCredential("xladminkey");
            if (cred instanceof oracle.security.jps.service.credstore.PasswordCredential) {
                oracle.security.jps.service.credstore.PasswordCredential pcred = (oracle.security.jps.service.credstore.PasswordCredential) cred;
                char[] p = pcred.getPassword();
                oimUserName = pcred.getName();
                oimPassword = new String(p);
            }

remember to keep the jps-api.jar and oimclient.jar in SCA-INF\lib

oimclient is for OIM API

Comments

Popular posts from this blog

OIM 11g R2 PS2 : SOA Approval Workflow Sample

OHS 12c (12.1.3) webgate deployment and configuration

Oracle Identity Manager (OIM) Interview Questions