Monday, October 28, 2013

ADF Security

1.Print the roles of the current user
for ( String role : ADFContext.getCurrent().getSecurityContext().getUserRoles() ) {
   System.out.println("role "+role);
}

2.Get the ADF security context and test if the user has the role users
SecurityContext sec = ADFContext.getCurrent().getSecurityContext();
if ( sec.isUserInRole("users") ) {
}

3.Is the user valid
public boolean isAuthenticated() {
 return ADFContext.getCurrent().getSecurityContext().isAuthenticated();}

4.Return the user
public String getCurrentUser() {
 return ADFContext.getCurrent().getSecurityContext().getUserName();
}

Source: http://blog.whitehorses.nl/2010/02/01/weblogic-web-application-container-security-part-2-adf-security/
Related Posts Plugin for WordPress, Blogger...