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

Java AuthConfigProvider类代码示例

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

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



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

示例1: getRegistrationIDs

import javax.security.auth.message.config.AuthConfigProvider; //导入依赖的package包/类
public String[] getRegistrationIDs(AuthConfigProvider provider)
{
   List<String> al = new ArrayList<String>();
   if (provider == null)
   {
      al.addAll(keyToAuthConfigProviderMap.keySet());
   }
   else
   {
      // get all entries that have the supplied provider as value and store their keys.
      for (Map.Entry<String, AuthConfigProvider> entry : this.keyToAuthConfigProviderMap.entrySet())
      {
         if (entry.getValue().equals(provider))
            al.add(entry.getKey());
      }
   }
   String[] sarr = new String[al.size()];
   al.toArray(sarr);
   return sarr;
}
 
开发者ID:picketbox,项目名称:picketbox,代码行数:21,代码来源:JBossAuthConfigFactory.java


示例2: 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


示例3: 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


示例4: 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


示例5: 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


示例6: 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


示例7: testClientFactoryConfig

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


示例8: getConfigProvider

import javax.security.auth.message.config.AuthConfigProvider; //导入依赖的package包/类
public AuthConfigProvider getConfigProvider(String layer, String appContext, RegistrationListener listener)
{
   String input = new StringBuilder().append(layer).append(appContext).toString();
   String allLayer = "null" + appContext;
   String allContext = layer + "null";
   String general = "nullnull";

   AuthConfigProvider acp = null;
   String key = null;
   for (int i = 0; i < 4 && acp == null; i++)
   {
      if (i == 0)
         key = input;
      if (i == 1)
         key = allLayer;
      if (i == 2)
         key = allContext;
      if (i == 3)
         key = general;

      acp = this.keyToAuthConfigProviderMap.get(key);
   }

   //
   if (listener != null)
      this.keyToRegistrationListenerMap.put(input, listener);

   return acp;
}
 
开发者ID:picketbox,项目名称:picketbox,代码行数:30,代码来源:JBossAuthConfigFactory.java


示例9: enableClientAuthentication

import javax.security.auth.message.config.AuthConfigProvider; //导入依赖的package包/类
public boolean enableClientAuthentication(Object target, Map<String, String> properties)
{
   if (!(target instanceof Client)) {
      Loggers.ROOT_LOGGER.cannotEnableJASPIAuthentication(target.getClass().getSimpleName());
      return false;
   }
   Client client = (Client)target;
   String securityDomain = properties.get(JaspiClientAuthenticator.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 = client.getEndpoint().getEndpointInfo().getName().toString();
   String appId = "localhost " + contextRoot;
   AuthConfigFactory factory = AuthConfigFactory.getFactory();

   Properties props = new Properties();
   AuthConfigProvider provider = new JBossWSAuthConfigProvider(props, factory);
   provider = factory.getConfigProvider(JBossWSAuthConstants.SOAP_LAYER, appId, null);
   JBossCallbackHandler callbackHandler = new JBossCallbackHandler();
   try
   {
      ClientAuthConfig clientConfig = provider.getClientAuthConfig("soap", appId, callbackHandler);
      JaspiClientAuthenticator clientAuthenticator = new JaspiClientAuthenticator(clientConfig, securityDomain, jai);
      client.getInInterceptors().add(new JaspiClientInInterceptor(clientAuthenticator));
      client.getOutInterceptors().add(new JaspiClientOutInterceptor(clientAuthenticator));
   }
   catch (Exception e)
   {
      Loggers.DEPLOYMENT_LOGGER.cannotCreateServerAuthContext(securityDomain, e);
   }

   return false;

}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:50,代码来源:DefaultJASPIAuthenticationProvider.java


示例10: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Instrumentation类代码示例发布时间:2022-05-22
下一篇:
Java PrintInputAndTarget类代码示例发布时间: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