Some useful APIs for ADF security
public void testPerm() {
// Security is enabled ?
ADFContext.getCurrent().getSecurityContext().isAuthorizationEnabled();
//User is authenticated ?
ADFContext.getCurrent().getSecurityContext().isAuthenticated();
// Get user name ,enterprise name and enterprise id
ADFContext.getCurrent().getSecurityContext().getUserName();
ADFContext.getCurrent().getEnterpriseName();
ADFContext.getCurrent().getEnterpriseId();
//Check user in a role
FacesContext.getCurrentInstance().getExternalContext().isUserInRole("app-role1");
//hasPermission to evaluate access policies
String pageName="testPage";
String action="view";
Permission p = new RegionPermission("view.pageDefs."+pageName+"PageDef",action);
ADFContext.getCurrent().getSecurityContext().hasPermission(p);
}
public void testPerm() {
// Security is enabled ?
ADFContext.getCurrent().getSecurityContext().isAuthorizationEnabled();
//User is authenticated ?
ADFContext.getCurrent().getSecurityContext().isAuthenticated();
// Get user name ,enterprise name and enterprise id
ADFContext.getCurrent().getSecurityContext().getUserName();
ADFContext.getCurrent().getEnterpriseName();
ADFContext.getCurrent().getEnterpriseId();
//Check user in a role
FacesContext.getCurrentInstance().getExternalContext().isUserInRole("app-role1");
//hasPermission to evaluate access policies
String pageName="testPage";
String action="view";
Permission p = new RegionPermission("view.pageDefs."+pageName+"PageDef",action);
ADFContext.getCurrent().getSecurityContext().hasPermission(p);
}
No comments:
Post a Comment