javax.security.auth.message.config.AuthConfigFactory.registerConfigProvider()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(12.2k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中javax.security.auth.message.config.AuthConfigFactory.registerConfigProvider()方法的一些代码示例,展示了AuthConfigFactory.registerConfigProvider()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AuthConfigFactory.registerConfigProvider()方法的具体详情如下:
包路径:javax.security.auth.message.config.AuthConfigFactory
类名称:AuthConfigFactory
方法名:registerConfigProvider

AuthConfigFactory.registerConfigProvider介绍

[英]Registers within the factory and records within the factory’s persistent declarative representation of provider registrations a provider of ServerAuthConfig and/or ClientAuthConfig objects for a message layer and application context identifier. This method typically constructs an instance of the provider before registering it with the factory. Factories may extend or modify the persisted registrations of existing provider instances, if those instances were registered with ClassName and properties arguments equivalent to those passed in the current call.

This method employs the two argument constructor required to be supported by every implementation of the AuthConfigProvider interface, and this method must pass a null value for the factory argument of the constructor. AuthConfigProviderImpl AuthConfigProviderImpl(Map properties, AuthConfigFactory factory).

At most one registration may exist within the factory for a given combination of message layer and appContext. Any pre-existing registration with identical values for layer and appContext is replaced by a subsequent registration. When replacement occurs, the registration identifier, layer, and appContext identifier remain unchanged, and the AuthConfigProvider (with initialization properties) and description are replaced.

Within the lifetime of its Java process, a factory must assign unique registration identifiers to registrations, and must never assign a previously used registration identifier to a registration whose message layer and or appContext identifier differ from the previous use.

Programmatic registrations performed by using this method must update (according to the replacement rules described above) the persistent declarative representation of provider registrations employed by the factory constructor.

When a SecurityManager is enabled, before loading the argument provider, and before making any changes to the factory, this method must confirm that the calling access control context has been granted the providerRegistrationSecurityPermission.
[中]在工厂内注册,并在工厂提供程序注册的永久声明性表示中记录消息层和应用程序上下文标识符的ServerAuthConfig和/或ClientAuthConfig对象的提供程序。此方法通常在向工厂注册提供程序之前构造提供程序的实例。如果使用与当前调用中传递的类名称和属性参数等效的类名称和属性参数注册现有提供程序实例,则工厂可以扩展或修改这些实例的持久注册。
此方法使用AuthConfigProvider接口的每个实现都需要支持的双参数构造函数,并且此方法必须为构造函数的工厂参数传递null值。AuthConfigProviderImpl AuthConfigProviderImpl(映射属性,AuthConfigFactory工厂)。
对于消息层和appContext的给定组合,工厂中最多可以存在一个注册。对于图层和appContext,具有相同值的任何预先存在的注册都将被后续注册替换。发生替换时,注册标识符、层和appContext标识符保持不变,并替换AuthConfigProvider(具有初始化属性)和说明。
在Java进程的生命周期内,工厂必须为注册分配唯一的注册标识符,并且决不能将以前使用的注册标识符分配给消息层和/或appContext标识符不同于以前使用的注册。
使用此方法执行的编程注册必须更新(根据上述替换规则)工厂构造函数使用的提供者注册的持久声明性表示。
启用SecurityManager时,在加载参数提供程序之前以及对工厂进行任何更改之前,此方法必须确认调用的访问控制上下文已被授予providerRegistrationSecurityPermission。

代码示例

代码示例来源:origin: javaee-samples/javaee7-samples

/**
 * Constructor with signature and implementation that's required by API.
 * 
 * @param properties
 * @param factory
 */
public TestAuthConfigProvider(Map<String, String> properties, AuthConfigFactory factory) {
  this.providerProperties = properties;
  // API requires self registration if factory is provided. Not clear
  // where the "layer" (2nd parameter)
  // and especially "appContext" (3rd parameter) values have to come from
  // at this place.
  if (factory != null) {
    factory.registerConfigProvider(this, null, null, "Auto registration");
  }
}

代码示例来源:origin: wildfly/wildfly

/**
 * Register the assembled configuration against the supplied {@link AuthConfigFactory}.
 *
 * @param authConfigFactory the {@link AuthConfigFactory} to register the configuration against.
 * @return The registration ID returned by the factory on registration.
 * @throws IllegalStateException if the configuration has already been registered.
 */
public String register(AuthConfigFactory authConfigFactory) {
  assertNotRegistered();
  registered = true;
  return authConfigFactory.registerConfigProvider(
      new ElytronAuthConfigProvider(messageLayer, applicationContext, serverAuthModules),
      messageLayer, applicationContext, description);
}

代码示例来源:origin: javaee-samples/javaee7-samples

/**
 * Registers the given SAM using the standard JASPIC {@link AuthConfigFactory} but using a small set of wrappers that just
 * pass the calls through to the SAM.
 * 
 * @param serverAuthModule
 */
public static void registerSAM(ServletContext context, ServerAuthModule serverAuthModule) {
  AuthConfigFactory.getFactory().registerConfigProvider(new TestAuthConfigProvider(serverAuthModule), "HttpServlet",
    getAppContextID(context), "Test authentication config provider");
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

public SimpleAuthConfigProvider(Map<String,String> properties, AuthConfigFactory factory) {
  this.properties = properties;
  if (factory != null) {
    factory.registerConfigProvider(this, null, null, "Automatic registration");
  }
}

代码示例来源:origin: org.jboss.ws.cxf/jbossws-cxf-jaspi

public JBossWSAuthConfigProvider(Properties props, AuthConfigFactory factory)
{
 contextProperties = props;
 if (factory != null)
 {
   factory.registerConfigProvider(this, "soap", null, "JBossWS AuthConfigProvider");
 }
}

代码示例来源:origin: org.picketbox/picketbox

/**
* Create a new JBossAuthConfigProvider.
* 
* @param props Context Properties
*/
public JBossAuthConfigProvider(Map<String,Object> props, AuthConfigFactory factory)
{
 this.contextProperties = props;
 
 // if a factory has been supplied this provider needs to register itself.
 if (factory != null)
   factory.registerConfigProvider(this, null, null, "JBossAuthConfigProvider Self Registration");
} 
/**

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

public SimpleAuthConfigProvider(Map<String,String> properties, AuthConfigFactory factory) {
  this.properties = properties;
  if (factory != null) {
    factory.registerConfigProvider(this, null, null, "Automatic registration");
  }
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

/**
 * Register the assembled configuration against the supplied {@link AuthConfigFactory}.
 *
 * @param authConfigFactory the {@link AuthConfigFactory} to register the configuration against.
 * @return The registration ID returned by the factory on registration.
 * @throws IllegalStateException if the configuration has already been registered.
 */
public String register(AuthConfigFactory authConfigFactory) {
  assertNotRegistered();
  registered = true;
  return authConfigFactory.registerConfigProvider(
      new ElytronAuthConfigProvider(messageLayer, applicationContext, serverAuthModules),
      messageLayer, applicationContext, description);
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-jaspi

/**
 * Register the assembled configuration against the supplied {@link AuthConfigFactory}.
 *
 * @param authConfigFactory the {@link AuthConfigFactory} to register the configuration against.
 * @return The registration ID returned by the factory on registration.
 * @throws IllegalStateException if the configuration has already been registered.
 */
public String register(AuthConfigFactory authConfigFactory) {
  assertNotRegistered();
  registered = true;
  return authConfigFactory.registerConfigProvider(
      new ElytronAuthConfigProvider(messageLayer, applicationContext, serverAuthModules),
      messageLayer, applicationContext, description);
}

代码示例来源:origin: javaee/security-soteria

public String run() {
    return AuthConfigFactory.getFactory().registerConfigProvider(
        new DefaultAuthConfigProvider(serverAuthModule),
        "HttpServlet", 
        getAppContextID(servletContext), 
        "Default single SAM authentication config provider");
  }
});

代码示例来源:origin: org.glassfish.soteria/javax.security.enterprise

public String run() {
    return AuthConfigFactory.getFactory().registerConfigProvider(
        new DefaultAuthConfigProvider(serverAuthModule),
        "HttpServlet", 
        getAppContextID(servletContext), 
        "Default single SAM authentication config provider");
  }
});

代码示例来源:origin: org.glassfish.main.security/jaspic.provider.framework

protected void oldSelfRegister() {
  if (getFactory() != null) {
    selfRegistered.clear();
    RegistrationContext[] contexts = getSelfRegistrationContexts();
    for (RegistrationContext r : contexts) {
      String id = getFactory().registerConfigProvider(this,
          r.getMessageLayer(), r.getAppContext(),
          r.getDescription());
      selfRegistered.add(id);
    }
  }
}

代码示例来源:origin: eclipse-ee4j/glassfish

protected void oldSelfRegister() {
  if (getFactory() != null) {
    selfRegistered.clear();
    RegistrationContext[] contexts = getSelfRegistrationContexts();
    for (RegistrationContext r : contexts) {
      String id = getFactory().registerConfigProvider(this,
          r.getMessageLayer(), r.getAppContext(),
          r.getDescription());
      selfRegistered.add(id);
    }
  }
}

代码示例来源:origin: org.apache.geronimo.components/geronimo-jaspi

public static String registerAuthConfigProvider(Reader config, String messageLayer, String appContext) throws ConfigException {
  try {
    ConfigProviderType configProviderType = JaspiXmlUtil.loadConfigProvider(config);
    AuthConfigProvider authConfigProvider = JaspiUtil.wrapAuthConfigProvider(configProviderType);
    return AuthConfigFactory.getFactory().registerConfigProvider(authConfigProvider, messageLayer, appContext, null);
  } catch (Exception e) {
    throw new ConfigException(e);
  }
}

代码示例来源:origin: org.apache.geronimo.components/geronimo-jaspi

public static String registerClientAuthModule(String messageLayer, String appContext, String authenticationContextID, Reader config, boolean _protected) throws ConfigException {
  try {
    AuthModuleType<ClientAuthModule> clientAuthModuleType = JaspiXmlUtil.loadClientAuthModule(config);
    AuthConfigProvider authConfigProvider = JaspiUtil.wrapClientAuthModule(messageLayer, appContext, authenticationContextID, clientAuthModuleType, _protected);
    return AuthConfigFactory.getFactory().registerConfigProvider(authConfigProvider, messageLayer, appContext, null);
  } catch (Exception e) {
    throw new ConfigException(e);
  }
}

代码示例来源:origin: org.apache.geronimo.components/geronimo-jaspi

public static String registerServerAuthModule(String messageLayer, String appContext, String authenticationContextID, Reader config, boolean _protected) throws ConfigException {
  try {
    AuthModuleType<ServerAuthModule> serverAuthModuleType = JaspiXmlUtil.loadServerAuthModule(config);
    AuthConfigProvider authConfigProvider = JaspiUtil.wrapServerAuthModule(messageLayer, appContext, authenticationContextID, serverAuthModuleType, _protected);
    return AuthConfigFactory.getFactory().registerConfigProvider(authConfigProvider, messageLayer, appContext, null);
  } catch (Exception e) {
    throw new ConfigException(e);
  }
}

代码示例来源:origin: org.apache.geronimo.components/geronimo-jaspi

public static String registerClientAuthContext(Reader config, boolean _protected) throws ConfigException {
  try {
    ClientAuthContextType clientAuthContextType = JaspiXmlUtil.loadClientAuthContext(config);
    AuthConfigProvider authConfigProvider = JaspiUtil.wrapClientAuthContext(clientAuthContextType, _protected);
    return AuthConfigFactory.getFactory().registerConfigProvider(authConfigProvider, clientAuthContextType.getMessageLayer(), clientAuthContextType.getAppContext(), null);
  } catch (Exception e) {
    throw new ConfigException(e);
  }
}

代码示例来源:origin: org.apache.geronimo.components/geronimo-jaspi

public static String registerServerAuthConfig(Reader config) throws ConfigException {
  try {
    ServerAuthConfigType serverAuthConfigType = JaspiXmlUtil.loadServerAuthConfig(config);
    AuthConfigProvider authConfigProvider = JaspiUtil.wrapServerAuthConfig(serverAuthConfigType);
    return AuthConfigFactory.getFactory().registerConfigProvider(authConfigProvider, serverAuthConfigType.getMessageLayer(), serverAuthConfigType.getAppContext(), null);
  } catch (Exception e) {
    throw new ConfigException(e);
  }
}

代码示例来源:origin: org.apache.geronimo.components/geronimo-jaspi

public static String registerClientAuthConfig(Reader config) throws ConfigException {
  try {
    ClientAuthConfigType clientAuthConfigType = JaspiXmlUtil.loadClientAuthConfig(config);
    AuthConfigProvider authConfigProvider = JaspiUtil.wrapClientAuthConfig(clientAuthConfigType);
    return AuthConfigFactory.getFactory().registerConfigProvider(authConfigProvider, clientAuthConfigType.getMessageLayer(), clientAuthConfigType.getAppContext(), null);
  } catch (Exception e) {
    throw new ConfigException(e);
  }
}

代码示例来源:origin: org.apache.geronimo.components/geronimo-jaspi

public static String registerServerAuthContext(Reader config, boolean _protected) throws ConfigException {
  try {
    ServerAuthContextType serverAuthContextType = JaspiXmlUtil.loadServerAuthContext(config);
    AuthConfigProvider authConfigProvider = JaspiUtil.wrapServerAuthContext(serverAuthContextType, _protected);
    return AuthConfigFactory.getFactory().registerConfigProvider(authConfigProvider, serverAuthContextType.getMessageLayer(), serverAuthContextType.getAppContext(), null);
  } catch (Exception e) {
    throw new ConfigException(e);
  }
}

相关文章