@Override public Object removeFromEnvironment(String propName) throws NamingException { Object out; if (this.initialContext == null) { out = this.defaultInitCtx.removeFromEnvironment(propName); } else { out = this.initialContext.removeFromEnvironment(propName); } return out; }
@Override public Object removeFromEnvironment(String propName) throws NamingException { Object out; if (this.initialContext == null) { out = this.defaultInitCtx.removeFromEnvironment(propName); } else { out = this.initialContext.removeFromEnvironment(propName); } return out; }
/** * {@inheritDoc} */ public Object removeFromEnvironment(String propName) throws NamingException { if (isInitialContextInitializerCall()) { return super.removeFromEnvironment(propName); } return getContext().removeFromEnvironment(propName); }
/** * @param subject the subject to set */ public void setSubject(Subject subject) { auth = new Authorization(subject); /* * for server side checks (e.g. sessioncontext.getCallerPrincipal()), we have to add * the SECURITY_PRINCIPAL to the initial context additionally, the server has to know, * which security domain to use - in jboss we do that in login-conf.xml. the application should * define a jboss.xml inside it's META-INF - perhaps using the 'client-login'. */ try { final Set<UserPrincipal> userPrincipals = subject != null ? subject.getPrincipals(UserPrincipal.class) : null; final UserPrincipal userPrincipal = userPrincipals != null && userPrincipals.size() > 0 ? userPrincipals.iterator() .next() : null; if (userPrincipal == null) { LOG.warn("No user principal defined --> services are not able to retrieve sessioncontext.getCallerPrincipal"); if (getServiceLocator().getInitialContext() != null) getServiceLocator().getInitialContext().removeFromEnvironment(Context.SECURITY_PRINCIPAL); } else { if (getServiceLocator().getInitialContext() != null) getServiceLocator().getInitialContext().addToEnvironment(Context.SECURITY_PRINCIPAL, userPrincipal); } } catch (final Exception e) { ManagedException.forward(e); } }