javax.resource.spi.work.SecurityContext Java Examples

The following examples show how to use javax.resource.spi.work.SecurityContext. 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: BaseCloneableBootstrapContext.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor
 */
public BaseCloneableBootstrapContext()
{
   this.transactionSynchronizationRegistry = null;
   this.workManager = null;
   this.workManagerName = null;
   this.xaTerminator = null;
   this.supportedContexts = new HashSet<Class>(4);

   this.supportedContexts.add(HintsContext.class);
   this.supportedContexts.add(SecurityContext.class);
   this.supportedContexts.add(TransactionContext.class);
   this.supportedContexts.add(DistributableContext.class);

   this.timers = null;

   this.id = null;
   this.name = null;
}
 
Example #2
Source File: BootstrapContextImpl.java    From ironjacamar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Constructor
 * @param wm The WorkManager
 * @param tsr The TransactionSynchronizationRegistry
 * @param terminator The XATerminator
 * @param validatorFactory the ValidatorFactory
 */
public BootstrapContextImpl(WorkManager wm,
                            TransactionSynchronizationRegistry tsr,
                            XATerminator terminator,
                            ValidatorFactory validatorFactory)
{
   this.workManager = wm;
   this.transactionSynchronizationRegistry = tsr;
   this.xaTerminator = terminator;
   this.supportedContexts = new HashSet<Class>(3);
   this.validatorFactory = validatorFactory;
   this.supportedContexts.add(HintsContext.class);
   this.supportedContexts.add(SecurityContext.class);
   this.supportedContexts.add(TransactionContext.class);

   this.timers = null;
}
 
Example #3
Source File: WorkManagerImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns true if contexts is a security context.
 *
 * @param workContextType context type
 * @return true if contexts is a security context
 */
private boolean isSecurityContext(Class<? extends WorkContext> workContextType)
{
   if (workContextType.isAssignableFrom(SecurityContext.class))
   {
      return true;
   }

   return false;
}
 
Example #4
Source File: WorkManagerImpl.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns true if contexts is a security context.
 *
 * @param workContextType context type
 * @return true if contexts is a security context
 */
private boolean isSecurityContext(Class<? extends WorkContext> workContextType)
{
   if (workContextType.isAssignableFrom(SecurityContext.class))
   {
      return true;
   }

   return false;
}
 
Example #5
Source File: SecurityContextHandler.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
public void before(final SecurityContext securityContext) throws WorkCompletedException {
    if (securityContext != null) {
        callbackHandler = new ConnectorCallbackHandler(securityRealmName);

        final Subject clientSubject = new Subject();
        securityContext.setupSecurityContext(callbackHandler, clientSubject, null);
    }
}
 
Example #6
Source File: SecurityContextHandler.java    From tomee with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void after(final SecurityContext securityContext) throws WorkCompletedException {
    final SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
    final Object loginObj = securityService.disassociate();
    if (loginObj != null) {
        try {
            securityService.logout(loginObj);
        } catch (final LoginException e) {
            //Ignore
        }
    }
}
 
Example #7
Source File: SecurityContextHandler.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
public boolean supports(final Class<? extends WorkContext> clazz) {
    return SecurityContext.class.isAssignableFrom(clazz);
}