• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PolicyContextException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addPermission

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
@Override
public void addPermission(GrantedPermission permissionDeclaration) {
	// todo : do we need to wrap these PolicyConfiguration calls in privileged actions like we do during permission checks?

	if ( policyConfiguration == null ) {
		policyConfiguration = locatePolicyConfiguration( contextId );
	}

	for ( String grantedAction : permissionDeclaration.getPermissibleAction().getImpliedActions() ) {
		final EJBMethodPermission permission = new EJBMethodPermission(
				permissionDeclaration.getEntityName(),
				grantedAction,
				null, // interfaces
				null // arguments
		);

		log.debugf( "Adding permission [%s] to role [%s]", grantedAction, permissionDeclaration.getRole() );
		try {
			policyConfiguration.addToRole( permissionDeclaration.getRole(), permission );
		}
		catch (PolicyContextException pce) {
			throw new HibernateException( "policy context exception occurred", pce );
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:StandardJaccServiceImpl.java


示例2: postSign

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
public void postSign(byte[] signatureValue, List<X509Certificate> signingCertificateChain) {
	LOG.debug("postSign");

	HttpServletRequest httpServletRequest;
	try {
		httpServletRequest = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
	} catch (PolicyContextException e) {
		throw new RuntimeException("JACC error: " + e.getMessage());
	}

	String signatureValueStr = new String(Hex.encodeHex(signatureValue));

	HttpSession session = httpServletRequest.getSession();
	session.setAttribute("SignatureValue", signatureValueStr);
	session.setAttribute("SigningCertificateChain", signingCertificateChain);
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:17,代码来源:FilesSignatureServiceBean.java


示例3: getIdentity

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
@Override
protected Principal getIdentity() {
	log.debug("Getting Identity");
	HttpServletRequest request = null;
	try {
		request = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
	} catch (PolicyContextException e) {
		log.error("Could not load HttpServletRequest", e);
		return null;
	}
	
	if (request == null) {
		return null;
	}
	
	return new SimplePrincipal((String) request.getAttribute("UNISON_USER"));
	
}
 
开发者ID:TremoloSecurity,项目名称:OpenUnison,代码行数:19,代码来源:UnisonLoginModule.java


示例4: getRequestParameter

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
private static String getRequestParameter(String key) {
    if (key == null) {
        return null;
    }
    Object request;
    try {
        request = PolicyContext.getContext(HttpServletRequest.class.getName());
    } catch (PolicyContextException ex) {
        logger.log(Level.SEVERE, ex.toString(), ex);
        return null;
    }
    if (request instanceof HttpServletRequest) {
        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
        String parameter = httpServletRequest.getParameter(key);
        logger.log(TRACE, "{0}: {1}", new Object[]{key, parameter});
        return parameter;
    }
    logger.log(TRACE, "HTTP Servlet Request: {0}", request);
    return null;
}
 
开发者ID:proyecto-adalid,项目名称:adalid,代码行数:21,代码来源:GoogleRecaptcha.java


示例5: getTimeBasedOTPFromRequest

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
private String getTimeBasedOTPFromRequest()
{
   String totp = null;

   //This is JBoss AS specific mechanism 
   String WEB_REQUEST_KEY = "javax.servlet.http.HttpServletRequest";

   try
   {
      HttpServletRequest request = (HttpServletRequest) PolicyContext.getContext(WEB_REQUEST_KEY);
      totp = request.getParameter( TOTP );
   }
   catch (PolicyContextException e)
   {
      PicketBoxLogger.LOGGER.debugErrorGettingRequestFromPolicyContext(e);
   }
   return totp; 
}
 
开发者ID:picketbox,项目名称:picketbox,代码行数:19,代码来源:JBossTimeBasedOTPLoginModule.java


示例6: getContextCallbackHandler

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
public CallbackHandler getContextCallbackHandler()
   throws PolicyContextException
{
   try
   {
      return (CallbackHandler) AccessController.doPrivileged(exAction);
   }
   catch(PrivilegedActionException e)
   {
      Exception ex = e.getException();
      if( ex instanceof PolicyContextException )
         throw (PolicyContextException) ex;
      else
         throw new UndeclaredThrowableException(ex);
   }
}
 
开发者ID:picketbox,项目名称:picketbox,代码行数:17,代码来源:SecurityActions.java


示例7: addToRole

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
void addToRole(String roleName, PermissionCollection permissions)
   throws PolicyContextException
{
   Permissions perms = rolePermissions.get(roleName);
   if( perms == null )
   {
      perms = new Permissions();
      rolePermissions.put(roleName, perms);
   }
   Enumeration<Permission> iter = permissions.elements();
   while( iter.hasMoreElements() )
   {
      Permission p = iter.nextElement();
      perms.add(p);
   }
}
 
开发者ID:picketbox,项目名称:picketbox,代码行数:17,代码来源:ContextPolicy.java


示例8: JBossPolicyConfiguration

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
protected JBossPolicyConfiguration(String contextID, DelegatingPolicy policy, StateMachine configStateMachine)
   throws PolicyContextException
{
   this.contextID = contextID;
   this.policy = policy;
   this.configStateMachine = configStateMachine;

   if (contextID == null)
      throw PicketBoxMessages.MESSAGES.invalidNullArgument("contextID");
   if (policy == null)
      throw PicketBoxMessages.MESSAGES.invalidNullArgument("policy");
   if (configStateMachine == null)
      throw PicketBoxMessages.MESSAGES.invalidNullArgument("configStateMachine");

   validateState("getPolicyConfiguration");
   PicketBoxLogger.LOGGER.debugJBossPolicyConfigurationConstruction(contextID);
}
 
开发者ID:picketbox,项目名称:picketbox,代码行数:18,代码来源:JBossPolicyConfiguration.java


示例9: doGet

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    request.setAttribute("jaccTest", "true");
    
    try {
        HttpServletRequest requestFromPolicy = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
        
        if (requestFromPolicy != null) {
            response.getWriter().print("Obtained request from context.");
            
            if ("true".equals(requestFromPolicy.getAttribute("jaccTest"))) {
                response.getWriter().print("Attribute present in request from context.");
            }
            
            if ("true".equals(requestFromPolicy.getParameter("jacc_test"))) {
                response.getWriter().print("Request parameter present in request from context.");
            }
            
        }
    } catch (PolicyContextException e) {
        e.printStackTrace(response.getWriter());
    }

}
 
开发者ID:ftomassetti,项目名称:JavaIncrementalParser,代码行数:26,代码来源:RequestServlet.java


示例10: doGet

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    request.setAttribute("jaccTest", "true");
    
    try {
        if (jaccRequestBean.getRequest() != null) {
            response.getWriter().print("Obtained request from context.");
            
            if (jaccRequestBean.hasAttribute()) {
                response.getWriter().print("Attribute present in request from context.");
            }
            
            if (jaccRequestBean.hasParameter()) {
                response.getWriter().print("Request parameter present in request from context.");
            }
            
        }
    } catch (PolicyContextException e) {
        e.printStackTrace(response.getWriter());
    }

}
 
开发者ID:ftomassetti,项目名称:JavaIncrementalParser,代码行数:24,代码来源:RequestServletEJB.java


示例11: implies

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
public boolean implies(final ProtectionDomain domain, final Permission permission) {
    final String contextID = PolicyContext.getContextID();

    if (contextID != null) {
        try {
            final BasicPolicyConfiguration configuration = configurations.get(contextID);

            if (configuration == null || !configuration.inService()) {
                return false;
            }

            return configuration.implies(domain, permission);
        } catch (final PolicyContextException e) {
            // no-op
        }
    }

    return systemPolicy != null ? systemPolicy.implies(domain, permission) : false;
}
 
开发者ID:apache,项目名称:tomee,代码行数:20,代码来源:BasicJaccProvider.java


示例12: getSubject

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
private String getSubject(HttpServletResponse response) throws IOException {
    try {
        Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container");
        Set<? extends Principal> principalSet = subject.getPrincipals(JsonWebToken.class);
        if(principalSet.size() > 0) {
            return "subject.getPrincipals(JsonWebToken.class) ok";
        }
        response.sendError(500, "subject.getPrincipals(JsonWebToken.class) == 0");
    }
    catch (PolicyContextException e) {
        e.printStackTrace();
        response.sendError(500, e.getMessage());
    }
    throw new IllegalStateException("subject.getPrincipals(JsonWebToken.class) == 0");
}
 
开发者ID:eclipse,项目名称:microprofile-jwt-auth,代码行数:16,代码来源:ServiceServlet.java


示例13: getContextSubject

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
@Override
public Subject getContextSubject() {
	try {
		return (Subject) PolicyContext.getContext( SUBJECT_CONTEXT_KEY );
	}
	catch (PolicyContextException e) {
		throw new HibernateException( "Unable to access JACC PolicyContext in order to locate calling Subject", e );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:StandardJaccServiceImpl.java


示例14: getHttpSession

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
/**
 * Gives back the current HTTP session using JACC.
 * 
 * @return
 */
public static HttpSession getHttpSession() {
	HttpServletRequest httpServletRequest;
	try {
		httpServletRequest = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
	} catch (PolicyContextException e) {
		throw new RuntimeException("JACC error: " + e.getMessage());
	}

	HttpSession httpSession = httpServletRequest.getSession();
	return httpSession;
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:17,代码来源:HttpSessionTemporaryDataStorage.java


示例15: checkNationalRegistrationCertificate

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
public void checkNationalRegistrationCertificate(List<X509Certificate> certificateChain) throws SecurityException {
	LOG.debug("checking national registry certificate...");

	HttpServletRequest httpServletRequest;
	try {
		httpServletRequest = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
	} catch (PolicyContextException e) {
		throw new RuntimeException("JACC error: " + e.getMessage());
	}

	HttpSession httpSession = httpServletRequest.getSession();
	X509Certificate certificate = certificateChain.get(0);
	httpSession.setAttribute("nationalRegistryCertificate", certificate);
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:15,代码来源:IdentityIntegrityServiceBean.java


示例16: validateCertificateChain

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
public void validateCertificateChain(List<X509Certificate> certificateChain) throws SecurityException {
	LOG.debug("validate certificate chain: " + certificateChain);

	HttpServletRequest httpServletRequest;
	try {
		httpServletRequest = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
	} catch (PolicyContextException e) {
		throw new RuntimeException("JACC error: " + e.getMessage());
	}

	HttpSession httpSession = httpServletRequest.getSession();
	httpSession.setAttribute("authenticationCertificateChain", certificateChain);
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:14,代码来源:AuthenticationServiceBean.java


示例17: getSessionContext

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
public SessionContextEntity getSessionContext() {
	HttpServletRequest httpServletRequest;
	try {
		httpServletRequest = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
	} catch (PolicyContextException e) {
		throw new RuntimeException("JACC error: " + e.getMessage());
	}
	HttpSession httpSession = httpServletRequest.getSession();
	String httpSessionId = httpSession.getId();
	SessionContextEntity sessionContextEntity = getSessionContextEntity(httpSessionId);
	return sessionContextEntity;
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:13,代码来源:SessionContextManagerBean.java


示例18: getHttpServletRequest

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
private HttpServletRequest getHttpServletRequest() {
	HttpServletRequest httpServletRequest;
	try {
		httpServletRequest = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
	} catch (PolicyContextException e) {
		throw new RuntimeException("JACC error: " + e.getMessage());
	}
	return httpServletRequest;
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:10,代码来源:TestReportFactory.java


示例19: checkNationalRegistrationCertificate

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
public void checkNationalRegistrationCertificate(List<X509Certificate> certificateChain) throws SecurityException {
	LOG.debug("checking national registry certificate...");

	HttpServletRequest httpServletRequest;
	try {
		httpServletRequest = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
	} catch (PolicyContextException e) {
		throw new RuntimeException("JACC error: " + e.getMessage());
	}

	HttpSession httpSession = httpServletRequest.getSession();
	X509Certificate certificate = certificateChain.get(0);
	httpSession.setAttribute("NationalRegistryCertificate", certificate);
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:15,代码来源:IdentityIntegrityServiceBean.java


示例20: getServerCertificate

import javax.security.jacc.PolicyContextException; //导入依赖的package包/类
public X509Certificate getServerCertificate() {
	LOG.debug("getServerCertificate");
	HttpServletRequest httpServletRequest;
	try {
		httpServletRequest = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
	} catch (PolicyContextException e) {
		throw new RuntimeException("JACC error: " + e.getMessage());
	}
	HttpSession httpSession = httpServletRequest.getSession();
	X509Certificate serverCertificate = (X509Certificate) httpSession
			.getAttribute(SERVER_CERTIFICATE_SESSION_ATTRIBUTE);
	return serverCertificate;
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:14,代码来源:ChannelBindingServiceBean.java



注:本文中的javax.security.jacc.PolicyContextException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClassUtil类代码示例发布时间:2022-05-22
下一篇:
Java ProviderName类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap