• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java SecurityAssociation类的典型用法和代码示例

java 3次浏览

本文整理汇总了Java中org.jboss.security.SecurityAssociation的典型用法代码示例。如果您正苦于以下问题:Java SecurityAssociation类的具体用法?Java SecurityAssociation怎么用?Java SecurityAssociation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

SecurityAssociation类属于org.jboss.security包,在下文中一共展示了SecurityAssociation类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: associate

点赞 3

import org.jboss.security.SecurityAssociation; //导入依赖的package包/类
/** associates the call context with the given info */
protected Subject associate(Principal userPrincipal, String passwd) {
log.debug("BasicAuthAuthorizationInterceptor - associate init");
   // pointer comparison, again	      
   if (shouldValidateUnauthenticatedCalls || userPrincipal != NobodyPrincipal.NOBODY_PRINCIPAL) {
      SecurityAssociation.setPrincipal(userPrincipal);
      SecurityAssociation.setCredential(passwd!=null ? passwd.toCharArray() : null);
      log.debug("BasicAuthAuthorizationInterceptor - associate " + userPrincipal.getName() );
   } else {
      // Jboss security normally does not like nobody:null
      SecurityAssociation.setPrincipal(null);
      SecurityAssociation.setCredential(null);
      log.debug("BasicAuthAuthorizationInterceptor - associate null" );
   }
   log.debug("BasicAuthAuthorizationInterceptor - associate end");         
   return authMgr.getActiveSubject();
}
 

开发者ID:GovernIB,
项目名称:sistra,
代码行数:18,
代码来源:BasicAuthAuthorizationInterceptor.java

示例2: prepareReturnValue

点赞 3

import org.jboss.security.SecurityAssociation; //导入依赖的package包/类
/**
 * Ensures that the current authenticated user is associated with the current
 * session so that security filtering is correct.
 *
 * @param invContext the method context
 * @return the method result
 * @throws Exception if invoking the method throws an exception.
 */
@AroundInvoke
@SuppressWarnings({"PMD.SignatureDeclareThrowsException", "ucd" }) 
public Object prepareReturnValue(InvocationContext invContext)
        throws Exception {
    String username = null;
    try {
        for (Principal p : SecurityAssociation.getSubject().getPrincipals()) {
            if (p instanceof org.jasig.cas.client.jaas.AssertionPrincipal) {
                username = p.getName();
                break;
            }
        }
        if (username == null) {
            username = sessionContext.getCallerPrincipal().getName();
        }
    } catch (IllegalStateException e) {
        username = SecurityUtils.ANONYMOUS_USERNAME;
    }
    CaArrayUsernameHolder.setUser(username);
    return invContext.proceed();
}
 

开发者ID:NCIP,
项目名称:caarray,
代码行数:30,
代码来源:AuthorizationInterceptor.java

示例3: push

点赞 2

import org.jboss.security.SecurityAssociation; //导入依赖的package包/类
public void push(final Principal principal, final Object credential, final Subject subject)
{
   AccessController.doPrivileged(new PrivilegedAction()
   {
      public Object run()
      {
         SecurityAssociation.pushSubjectContext(subject, principal, credential);
         return null;
      }
   });
}
 

开发者ID:rh-messaging,
项目名称:artemis-wildfly-integration,
代码行数:12,
代码来源:AS4SecurityActions.java

示例4: dup

点赞 2

import org.jboss.security.SecurityAssociation; //导入依赖的package包/类
public void dup()
{
   AccessController.doPrivileged(new PrivilegedAction()
   {
      public Object run()
      {
         SecurityAssociation.dupSubjectContext();
         return null;
      }
   });
}
 

开发者ID:rh-messaging,
项目名称:artemis-wildfly-integration,
代码行数:12,
代码来源:AS4SecurityActions.java

示例5: pop

点赞 2

import org.jboss.security.SecurityAssociation; //导入依赖的package包/类
public void pop()
{
   AccessController.doPrivileged(new PrivilegedAction()
   {
      public Object run()
      {
         SecurityAssociation.popSubjectContext();
         return null;
      }
   });
}
 

开发者ID:rh-messaging,
项目名称:artemis-wildfly-integration,
代码行数:12,
代码来源:AS4SecurityActions.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)