Java Code Examples for org.jboss.security.SecurityContextAssociation#setSecurityContext()

The following examples show how to use org.jboss.security.SecurityContextAssociation#setSecurityContext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PicketBoxSecurityIntegration.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void setSecurityContext(org.jboss.jca.core.spi.security.SecurityContext context)
{
   if (context == null)
   {
      SecurityContextAssociation.setSecurityContext(null);
   }
   else if (context instanceof PicketBoxSecurityContext)
   {
      PicketBoxSecurityContext psc = (PicketBoxSecurityContext)context;
      SecurityContextAssociation.setSecurityContext(psc.getDelegator());
   }
   else
   {
      throw new IllegalArgumentException("Invalid SecurityContext: " + context);
   }
}
 
Example 2
Source File: SubjectActions.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public void push(Principal principal, Object credential, Subject subject,
      String securityDomain)
{
   //SecurityAssociation.pushSubjectContext(subject, principal, credential);
   SecurityContext sc = SecurityContextAssociation.getSecurityContext();
   if(sc == null)
   {
      try
      {
         sc = SecurityContextFactory.createSecurityContext(principal, credential,
               subject, securityDomain);
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
      }
   }
   else
   {
      sc.getUtil().createSubjectInfo(principal, credential, subject); 
   }
   SecurityContextAssociation.setSecurityContext(sc); 
}
 
Example 3
Source File: SubjectActions.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public void push(Principal principal, Object credential, Subject subject,
      String securityDomain)
{
   //SecurityAssociation.pushSubjectContext(subject, principal, credential);
   SecurityContext sc = SecurityContextAssociation.getSecurityContext();
   if(sc == null)
   {
      try
      {
         sc = SecurityContextFactory.createSecurityContext(principal, credential,
               subject, securityDomain);
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
      }
   }
   else
   {
      sc.getUtil().createSubjectInfo(principal, credential, subject); 
   }
   SecurityContextAssociation.setSecurityContext(sc); 
}
 
Example 4
Source File: PicketBoxSecurityIntegration.java    From ironjacamar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void setSecurityContext(org.ironjacamar.core.spi.security.SecurityContext context)
{
   if (context == null)
   {
      SecurityContextAssociation.setSecurityContext(null);
   }
   else if (context instanceof PicketBoxSecurityContext)
   {
      PicketBoxSecurityContext psc = (PicketBoxSecurityContext)context;
      SecurityContextAssociation.setSecurityContext(psc.getDelegator());
   }
   else
   {
      throw new IllegalArgumentException("Invalid SecurityContext: " + context);
   }
}
 
Example 5
Source File: JBossSecurityClient.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void setSecurityContext(SecurityContext securityContext) {
   SecurityContextAssociation.setSecurityContext(securityContext);
}