Extracting Username from service policy using JAVA Embedding activity in bpel.
1. Create a bpel variable "securityUserVar"
2. drag a java embedding activity in bpel flow and use below block of code for i to extract the username form service policy subject and assign it to the bpel variable.
try{
System.out.println("***Inside JAVA Embedding****\n");
javax.security.auth.Subject currentSubject = oracle.security.jps.util.SubjectUtil.getCurrentSubject();
String username = oracle.security.jps.util.SubjectUtil.getUserName(currentSubject);
setVariableData("securityUserVar",username);
}
catch(Exception e)
{
e.printStackTrace();
}
3. Now the bpel variable is holding the username and use the variable "securityUserVar" where ever the username is required in the flow.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.