Navigation for accessing weblogic credential store in SOA:
- Login to Weblogic EM (Enterprise Manager)
- In the navigator choose your Weblogic Domain
- Click WebLogic Domain and then select Security and click Credentials.
- All credentials will be listed. Map "oracle.wsm.security" has the key "basic.credentials":
In SOA use the Java Embedding and write the below code in it:
try { oracle.security.jps.JpsContextFactory jpsCtxFactory = oracle.security.jps.JpsContextFactory.getContextFactory(); oracle.security.jps.JpsContext jpsCtx = jpsCtxFactory.getContext(); oracle.security.jps.service.credstore.CredentialStore credStore = jpsCtx.getServiceInstance(oracle.security.jps.service.credstore.CredentialStore.class); oracle.security.jps.service.credstore.PasswordCredential cred = (oracle.security.jps.service.credstore.PasswordCredential)credStore.getCredential("oracle.wsm.security", "basic.credentials"); if (cred == null) { System.out.println("Credential not found."); } else { String username = cred.getName(); setVariableData("username",username); String password = String.valueOf(cred.getPassword()); setVariableData("password",password); //System.out.println("Credential username: " + username); //System.out.println("Credential password: " + password); } } catch (Exception e) { e.printStackTrace(); addAuditTrailEntry(e); }
Comments
Post a Comment