Get current logged in user

To return the current logged in user in the application, it can be obtained using Java Code, or Expression Language:

  • Java Code - from inside a Managed Bean:
ADFContext adfCtx = ADFContext.getCurrent(); 
SecurityContext secCntx = adfCtx.getSecurityContext(); 
String username1 = secCntx.getUserPrincipal().getName(); 
String username2 = secCntx.getUserName(); 

  • Expression Language - from the Property Inspector or from the Model View Object attribute level:
#{securityContext.userName}

No comments:

Post a Comment