This discussion is archived
7 Replies Latest reply: Dec 5, 2012 8:30 PM by bigchill RSS

Override logged in user name

931325 Explorer
Currently Being Moderated
Hello All,
My JDev version is 11.1.2.0.0.

I am trying to accomplish converting the logged in userName to UPPERCASE irrespective of the case they enter in login page and carry it across the entire application, like it should be stored in the DB and all other calls with regard to user name should be done with upper case.

I've tried the below in by extending the AMImpl. prepareSession method.

String loggedInUser = getUserPrincipalName().toUpperCase();
// String contextUser = ADFContext.getCurrent().getSecurityContext().getUserName();
// String envUser = (String)session.getEnvironment().get(PropertyMetadata.USER_PRINCIPAL.getName());
if (loggedInUser != null) {
session.getEnvironment().put(PropertyMetadata.USER_PRINCIPAL.getName(), loggedInUser.toUpperCase());
}

The above code snippet ensures that the outcome of the below is UPPERCASE.
public String getUserPrincipalName()
{
return ((SessionImpl)mSession).getUserPrincipalName();
}

But how to override the one in SecurityContext?
Getting the userName from Principal principal = FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal().getName(); from BackingBean does NOT return me the logged in user in UPPERCASE.

Any thoughts on how I can override the logged in user name across the application?

Thanks !

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points