当前位置: 首页>>代码示例>>Java>>正文


Java AuthConfigProvider.getServerAuthConfig方法代码示例

本文整理汇总了Java中javax.security.auth.message.config.AuthConfigProvider.getServerAuthConfig方法的典型用法代码示例。如果您正苦于以下问题:Java AuthConfigProvider.getServerAuthConfig方法的具体用法?Java AuthConfigProvider.getServerAuthConfig怎么用?Java AuthConfigProvider.getServerAuthConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.security.auth.message.config.AuthConfigProvider的用法示例。


在下文中一共展示了AuthConfigProvider.getServerAuthConfig方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSuccessfulJASPI

import javax.security.auth.message.config.AuthConfigProvider; //导入方法依赖的package包/类
public void testSuccessfulJASPI() throws Exception
{
   AuthConfigProvider provider = factory.getConfigProvider(layer, appId, null);
   ServerAuthConfig serverConfig = provider.getServerAuthConfig(layer, appId, new AppCallbackHandler("jduke",
         "theduke".toCharArray()));
   assertNotNull("ServerAuthConfig is not null", serverConfig);

   MessageInfo mi = new GenericMessageInfo(new Object(), new Object());
   String authContextID = serverConfig.getAuthContextID(mi);
   assertNotNull("AuthContext ID != null", authContextID);
   ServerAuthContext sctx = serverConfig.getAuthContext(authContextID, new Subject(), new HashMap());
   assertNotNull("ServerAuthContext != null", sctx);
   Subject clientSubject = new Subject();
   Subject serviceSubject = new Subject();
   AuthStatus status = sctx.validateRequest(mi, clientSubject, serviceSubject);
   assertEquals(AuthStatus.SUCCESS, status);
}
 
开发者ID:picketbox,项目名称:picketbox,代码行数:18,代码来源:JASPILoginModuleDelgateUnitTestCase.java

示例2: testUnSuccessfulJASPI

import javax.security.auth.message.config.AuthConfigProvider; //导入方法依赖的package包/类
public void testUnSuccessfulJASPI() throws Exception
{
   AuthConfigProvider provider = factory.getConfigProvider(layer, appId, null);
   ServerAuthConfig serverConfig = provider.getServerAuthConfig(layer, appId, new AppCallbackHandler("jduke",
         "badpwd".toCharArray()));
   assertNotNull("ServerAuthConfig is not null", serverConfig);

   MessageInfo mi = new GenericMessageInfo(new Object(), new Object());
   String authContextID = serverConfig.getAuthContextID(mi);
   assertNotNull("AuthContext ID != null", authContextID);
   ServerAuthContext sctx = serverConfig.getAuthContext(authContextID, new Subject(), new HashMap());
   assertNotNull("ServerAuthContext != null", sctx);
   Subject clientSubject = new Subject();
   Subject serviceSubject = new Subject();
   try
   {
      AuthStatus status = sctx.validateRequest(mi, clientSubject, serviceSubject);
      assertEquals(AuthStatus.FAILURE, status);
   }
   catch (AuthException ae)
   {
      // Pass
   }
}
 
开发者ID:picketbox,项目名称:picketbox,代码行数:25,代码来源:JASPILoginModuleDelgateUnitTestCase.java

示例3: testSuccessfulJASPI

import javax.security.auth.message.config.AuthConfigProvider; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void testSuccessfulJASPI() throws Exception
{
   AuthConfigProvider provider = factory.getConfigProvider(layer, appId, null);
   ServerAuthConfig serverConfig = provider.getServerAuthConfig(layer, appId, new AppCallbackHandler("anil",
         "anilpwd".toCharArray()));
   assertNotNull("ServerAuthConfig is not null", serverConfig);

   MessageInfo mi = new GenericMessageInfo(new Object(), new Object());
   String authContextID = serverConfig.getAuthContextID(mi);
   assertNotNull("AuthContext ID != null", authContextID);
   ServerAuthContext sctx = serverConfig.getAuthContext(authContextID, new Subject(), new HashMap());
   assertNotNull("ServerAuthContext != null", sctx);
   Subject clientSubject = new Subject();
   Subject serviceSubject = new Subject();
   AuthStatus status = sctx.validateRequest(mi, clientSubject, serviceSubject);
   assertEquals(AuthStatus.SUCCESS, status);
}
 
开发者ID:picketbox,项目名称:picketbox,代码行数:19,代码来源:JASPIWorkflowUnitTestCase.java

示例4: testUnSuccessfulJASPI

import javax.security.auth.message.config.AuthConfigProvider; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void testUnSuccessfulJASPI() throws Exception
{
   AuthConfigProvider provider = factory.getConfigProvider(layer, appId, null);
   ServerAuthConfig serverConfig = provider.getServerAuthConfig(layer, appId, new AppCallbackHandler("anil",
         "badpwd".toCharArray()));
   assertNotNull("ServerAuthConfig is not null", serverConfig);

   validateJAASConfiguration();
   MessageInfo mi = new GenericMessageInfo(new Object(), new Object());
   String authContextID = serverConfig.getAuthContextID(mi);
   assertNotNull("AuthContext ID != null", authContextID);
   ServerAuthContext sctx = serverConfig.getAuthContext(authContextID, new Subject(), new HashMap());
   assertNotNull("ServerAuthContext != null", sctx);
   Subject clientSubject = new Subject();
   Subject serviceSubject = new Subject();
   try
   {
      AuthStatus status = sctx.validateRequest(mi, clientSubject, serviceSubject);
      assertEquals(AuthStatus.FAILURE, status);
   }
   catch (AuthException ae)
   {
      //Ignore - we are fine
   }
}
 
开发者ID:picketbox,项目名称:picketbox,代码行数:27,代码来源:JASPIWorkflowUnitTestCase.java

示例5: testServerFactoryConfig

import javax.security.auth.message.config.AuthConfigProvider; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void testServerFactoryConfig() throws Exception
{ 
   assertNotNull("AuthConfigFactory is ! null", factory); 
   AuthConfigProvider provider = factory.getConfigProvider("TEST", "APP", null);
   assertNotNull("AuthConfigProvider is ! null", provider);
   
   ServerAuthConfig serverConfig =
      provider.getServerAuthConfig("TEST", "APP", 
            new AppCallbackHandler("anil","anil".toCharArray()));
   assertNotNull("ServerAuthConfig ! null", serverConfig); 
   MessageInfo mi = new GenericMessageInfo(new Object(), new Object());
   String authContextID = serverConfig.getAuthContextID(mi);
   assertNotNull("AuthContext ID != null",authContextID);
   ServerAuthContext sctx = serverConfig.getAuthContext(authContextID, 
         new Subject(), new HashMap());
   assertNotNull("ServerAuthContext != null",sctx); 
}
 
开发者ID:picketbox,项目名称:picketbox,代码行数:19,代码来源:JASPIConfigUnitTestCase.java

示例6: enableServerAuthentication

import javax.security.auth.message.config.AuthConfigProvider; //导入方法依赖的package包/类
public boolean enableServerAuthentication(Deployment dep, JBossWebservicesMetaData wsmd)
{
   String securityDomain = null;
   if (wsmd != null)
   {
      securityDomain = wsmd.getProperty(JaspiServerAuthenticator.JASPI_SECURITY_DOMAIN);
   }
   if (securityDomain == null)
   {
      return false;
   }
   ApplicationPolicy appPolicy = SecurityConfiguration.getApplicationPolicy(securityDomain);
   if (appPolicy == null)
   {
      Loggers.ROOT_LOGGER.noApplicationPolicy(securityDomain);
      return false;
   }
   BaseAuthenticationInfo bai = appPolicy.getAuthenticationInfo();
   if (bai == null || bai instanceof AuthenticationInfo)
   {
      Loggers.ROOT_LOGGER.noJaspiApplicationPolicy(securityDomain);
      return false;
   }
   JASPIAuthenticationInfo jai = (JASPIAuthenticationInfo) bai;

   String contextRoot = dep.getService().getContextRoot();
   String appId = "localhost " + contextRoot;
   AuthConfigFactory factory = AuthConfigFactory.getFactory();
   Properties properties = new Properties();
   AuthConfigProvider provider = new JBossWSAuthConfigProvider(properties, factory);
   provider = factory.getConfigProvider(JBossWSAuthConstants.SOAP_LAYER, appId, null);

   JBossCallbackHandler callbackHandler = new JBossCallbackHandler();
   try
   {
      ServerAuthConfig serverConfig = provider.getServerAuthConfig(JBossWSAuthConstants.SOAP_LAYER, appId,
            callbackHandler);
      Properties serverContextProperties = new Properties();
      serverContextProperties.put("security-domain", securityDomain);
      serverContextProperties.put("jaspi-policy", jai);
      Bus bus = dep.getAttachment(Bus.class);
      serverContextProperties.put(Bus.class, bus);
      String authContextID = dep.getSimpleName();
      ServerAuthContext sctx = serverConfig.getAuthContext(authContextID, null, serverContextProperties);
      JaspiServerAuthenticator serverAuthenticator = new JaspiServerAuthenticator(sctx);
      bus.getInInterceptors().add(new JaspiSeverInInterceptor(serverAuthenticator));
      bus.getOutInterceptors().add(new JaspiSeverOutInterceptor(serverAuthenticator));
      return true;
   }
   catch (Exception e)
   {
      Loggers.DEPLOYMENT_LOGGER.cannotCreateServerAuthContext(securityDomain, e);
   }
   return false;
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:56,代码来源:DefaultJASPIAuthenticationProvider.java


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