當前位置: 首頁>>代碼示例>>Java>>正文


Java RunAs類代碼示例

本文整理匯總了Java中org.jboss.security.RunAs的典型用法代碼示例。如果您正苦於以下問題:Java RunAs類的具體用法?Java RunAs怎麽用?Java RunAs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RunAs類屬於org.jboss.security包,在下文中一共展示了RunAs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: remove

import org.jboss.security.RunAs; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public <T> T remove(String key)
{ 
   if(key == null)
      throw PicketBoxMessages.MESSAGES.invalidNullArgument("key");
   Map<String,Object> contextMap = securityContext.getData();
   if(RUNAS_IDENTITY_IDENTIFIER.equals(key))
   {
      RunAs runAs = securityContext.getOutgoingRunAs();
      //Move the caller RAI to current RAI 
      securityContext.setOutgoingRunAs((RunAs) contextMap.get(CALLER_RAI_IDENTIFIER));
      
      //Clear the Caller RAI
      contextMap.remove(CALLER_RAI_IDENTIFIER); 
      return (T) runAs;
   }
   return (T) contextMap.remove(key);
}
 
開發者ID:picketbox,項目名稱:picketbox,代碼行數:20,代碼來源:JBossSecurityContextUtil.java

示例2: authorize

import org.jboss.security.RunAs; //導入依賴的package包/類
/**
 * @see AuthorizationModuleDelegate#authorize(org.jboss.security.authorization.Resource, javax.security.auth.Subject, org.jboss.security.identity.RoleGroup)
 */
public int authorize(Resource resource, Subject callerSubject, RoleGroup role)
{
   if(resource instanceof EJBResource == false)
      throw PicketBoxMessages.MESSAGES.invalidType(EJBResource.class.getName());

   EJBResource ejbResource = (EJBResource) resource;
   
   //Get the context map
   Map<String,Object> map = resource.getMap();
   if(map == null)
      throw PicketBoxMessages.MESSAGES.invalidNullProperty("resourceMap");

   this.policyRegistration = (PolicyRegistration) map.get(ResourceKeys.POLICY_REGISTRATION);
   
   this.ejbCS = ejbResource.getCodeSource();
   this.ejbMethod = ejbResource.getEjbMethod();
   this.ejbName = ejbResource.getEjbName();
   this.methodInterface = ejbResource.getEjbMethodInterface();
   RunAs runAs = ejbResource.getCallerRunAsIdentity();
   if (runAs instanceof RunAsIdentity)
     this.callerRunAs = RunAsIdentity.class.cast(runAs);
   
   //isCallerInRole checks
   this.roleName = (String)map.get(ResourceKeys.ROLENAME); 
   
   this.roleRefCheck = (Boolean)map.get(ResourceKeys.ROLEREF_PERM_CHECK);
   if(this.roleRefCheck == Boolean.TRUE)
      return checkRoleRef(callerSubject, role);
   else
      return process(callerSubject, role);
}
 
開發者ID:picketbox,項目名稱:picketbox,代碼行數:35,代碼來源:EJBJACCPolicyModuleDelegate.java

示例3: isTrusted

import org.jboss.security.RunAs; //導入依賴的package包/類
@Override
public TrustDecision isTrusted() throws IdentityTrustException
{ 
   RunAs runAs = this.securityContext.getIncomingRunAs();
   if(runAs instanceof RunAsIdentity )
   {
      RunAsIdentity runAsIdentity = (RunAsIdentity)runAs;
      if(SecurityConstants.JAVAEE.equals(runAsIdentity.getProof()))
            return TrustDecision.Permit;
   }
   return TrustDecision.NotApplicable;
}
 
開發者ID:picketbox,項目名稱:picketbox,代碼行數:13,代碼來源:JavaEETrustModule.java

示例4: getIncomingRunAs

import org.jboss.security.RunAs; //導入依賴的package包/類
static RunAs getIncomingRunAs(final SecurityContext sc)
{
   return AccessController.doPrivileged(new PrivilegedAction<RunAs>()
   {
      public RunAs run()
      {
         return sc.getIncomingRunAs();
      }
   });  
}
 
開發者ID:picketbox,項目名稱:picketbox,代碼行數:11,代碼來源:SecurityActions.java

示例5: setRunAsIdentity

import org.jboss.security.RunAs; //導入依賴的package包/類
private void setRunAsIdentity(RunAsIdentity rai)
{
   Map<String,Object> contextMap = securityContext.getData();
   
   //Move the current RAI on the sc into the caller rai
   RunAs currentRA = securityContext.getOutgoingRunAs(); 
   contextMap.put(CALLER_RAI_IDENTIFIER, currentRA);
   
   securityContext.setOutgoingRunAs(rai); 
}
 
開發者ID:picketbox,項目名稱:picketbox,代碼行數:11,代碼來源:JBossSecurityContextUtil.java

示例6: setIncomingRunAs

import org.jboss.security.RunAs; //導入依賴的package包/類
/**
 * @see SecurityContext#setOutgoingRunAs(RunAs)
 * 
 * @throws SecurityException  Under a security manager, caller does not have
 *  RuntimePermission("org.jboss.security.plugins.JBossSecurityContext.setRunAsPermission")
 * 
 */
public void setIncomingRunAs(RunAs runAs)
{ 
   SecurityManager sm = System.getSecurityManager();
   if (sm != null)
      sm.checkPermission(setRunAsPermission);
   
   this.incomingRunAs = runAs;
}
 
開發者ID:picketbox,項目名稱:picketbox,代碼行數:16,代碼來源:JBossSecurityContext.java

示例7: setOutgoingRunAs

import org.jboss.security.RunAs; //導入依賴的package包/類
/**
 * @see SecurityContext#setOutgoingRunAs(RunAs)
 * 
 * @throws SecurityException  Under a security manager, caller does not have
 *  RuntimePermission("org.jboss.security.plugins.JBossSecurityContext.setRunAsPermission")
 */
public void setOutgoingRunAs(RunAs runAs)
{ 
   SecurityManager sm = System.getSecurityManager();
   if (sm != null)
      sm.checkPermission(setRunAsPermission);
  
   this.outgoingRunAs = runAs;
}
 
開發者ID:picketbox,項目名稱:picketbox,代碼行數:15,代碼來源:JBossSecurityContext.java

示例8: testJavaEERunAsIdentity

import org.jboss.security.RunAs; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public void testJavaEERunAsIdentity() throws Exception
{
   JBossSecurityContext sc = new JBossSecurityContext("conf-javaee");
   sc.setIncomingRunAs(new RunAsIdentity("theduke", "jduke"));
   assertNotNull("SecurityContext is not null", sc);
   IdentityTrustManager itm = sc.getIdentityTrustManager();
   assertNotNull("IdentityTrustManager is not null", itm);
   assertEquals("Is Trusted", TrustDecision.Permit, itm.isTrusted(sc));

   sc.setIncomingRunAs(new RunAs()
   {
      public <T> T getIdentity()
      {
         return (T) "BAD";
      }

      public <T> T getProof()
      {
         return (T) "BAD";
      }

      public String getName()
      {
         return "BAD";
      }
   });

   assertEquals("Is Trusted is false", TrustDecision.NotApplicable, itm.isTrusted(sc));
}
 
開發者ID:picketbox,項目名稱:picketbox,代碼行數:31,代碼來源:IdentityTrustUnitTestCase.java

示例9: JBossContainerContext

import org.jboss.security.RunAs; //導入依賴的package包/類
private JBossContainerContext(org.jboss.security.SecurityContext securityContext, RoleGroup roleGroup, RunAs runAs) {
    this._securityContext = securityContext;
    this._roleGroup = roleGroup;
    this._runAs = runAs;
}
 
開發者ID:jboss-switchyard,項目名稱:switchyard,代碼行數:6,代碼來源:JBossSecurityProvider.java

示例10: run

import org.jboss.security.RunAs; //導入依賴的package包/類
public RunAs run()
{
   return SecurityContextAssociation.peekRunAsIdentity();
}
 
開發者ID:rareddy,項目名稱:ws-security-examples,代碼行數:5,代碼來源:GetPrincipalInfoAction.java

示例11: peek

import org.jboss.security.RunAs; //導入依賴的package包/類
public RunAs peek()
{
   return SecurityContextAssociation.peekRunAsIdentity();
}
 
開發者ID:rareddy,項目名稱:ws-security-examples,代碼行數:5,代碼來源:GetPrincipalInfoAction.java

示例12: getCallerRunAsIdentity

import org.jboss.security.RunAs; //導入依賴的package包/類
/**
 * Get the Caller RunAsIdentity
 * @return
 */
public RunAs getCallerRunAsIdentity()
{
   return callerRunAsIdentity;
}
 
開發者ID:picketbox,項目名稱:picketbox,代碼行數:9,代碼來源:JavaEEResource.java

示例13: setCallerRunAsIdentity

import org.jboss.security.RunAs; //導入依賴的package包/類
/**
 * Set the Caller RunAsIdentity
 * @param callerRunAsIdentity
 */
public void setCallerRunAsIdentity(RunAs callerRunAsIdentity)
{
   this.callerRunAsIdentity = callerRunAsIdentity;
}
 
開發者ID:picketbox,項目名稱:picketbox,代碼行數:9,代碼來源:JavaEEResource.java

示例14: getIncomingRunAs

import org.jboss.security.RunAs; //導入依賴的package包/類
/**
 * @see SecurityContext#getOutgoingRunAs()
 */
public RunAs getIncomingRunAs()
{ 
   return this.incomingRunAs;
}
 
開發者ID:picketbox,項目名稱:picketbox,代碼行數:8,代碼來源:JBossSecurityContext.java

示例15: getOutgoingRunAs

import org.jboss.security.RunAs; //導入依賴的package包/類
/**
 * @see SecurityContext#getOutgoingRunAs()
 */
public RunAs getOutgoingRunAs()
{ 
   return this.outgoingRunAs;
}
 
開發者ID:picketbox,項目名稱:picketbox,代碼行數:8,代碼來源:JBossSecurityContext.java


注:本文中的org.jboss.security.RunAs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。