本文整理汇总了Java中javax.security.auth.message.config.AuthConfigFactory类的典型用法代码示例。如果您正苦于以下问题:Java AuthConfigFactory类的具体用法?Java AuthConfigFactory怎么用?Java AuthConfigFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthConfigFactory类属于javax.security.auth.message.config包,在下文中一共展示了AuthConfigFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerServerAuthModule
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
/**
* Registers a server auth module as the one and only module for the application corresponding to
* the given servlet context.
* <p/>
* <p/>
* This will override any other modules that have already been registered, either via proprietary
* means or using the standard API.
*
* @param serverAuthModule the server auth module to be registered
* @param servletContext the context of the app for which the module is registered
* @return A String identifier assigned by an underlying factory corresponding to an underlying factory-factory-factory registration
*/
public static String registerServerAuthModule(ServerAuthModule serverAuthModule, ServletContext servletContext) {
// Register the factory-factory-factory for the SAM
String registrationId = AuthConfigFactory.getFactory().registerConfigProvider(
new DefaultAuthConfigProvider(serverAuthModule),
"HttpServlet",
getAppContextID(servletContext),
"Default single SAM authentication config provider"
);
// Remember the registration ID returned by the factory, so we can unregister the JASPIC module when the web module
// is undeployed. JASPIC being the low level API that it is won't do this automatically.
servletContext.setAttribute(CONTEXT_REGISTRATION_ID, registrationId);
return registrationId;
}
示例2: setUp
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
factory = AuthConfigFactory.getFactory();
factory.registerConfigProvider(new JBossAuthConfigProvider(new HashMap(), null), layer, appId,
"Test Config Provider");
JBossSecurityContext jsc = new JBossSecurityContext("conf-jaspi-2");
SecurityContextAssociation.setSecurityContext(jsc);
XMLLoginConfigImpl xli = XMLLoginConfigImpl.getInstance();
SecurityActions.setJAASConfiguration(xli);
URL configURL = Thread.currentThread().getContextClassLoader().getResource(configFile);
assertNotNull("Config URL", configURL);
xli.setConfigURL(configURL);
xli.loadConfig();
}
示例3: setUp
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void setUp() throws Exception
{
factory = AuthConfigFactory.getFactory();
factory.registerConfigProvider(new JBossAuthConfigProvider(new HashMap(), null), layer, appId,
"Test Config Provider");
SecurityContext jsc = new JBossSecurityContext("conf-jaspi");
SecurityContextAssociation.setSecurityContext(jsc);
XMLLoginConfigImpl xli = XMLLoginConfigImpl.getInstance();
SecurityActions.setJAASConfiguration(xli);
URL configURL = Thread.currentThread().getContextClassLoader().getResource(configFile);
assertNotNull("Config URL", configURL);
xli.setConfigURL(configURL);
xli.loadConfig();
}
示例4: setUp
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void setUp() throws Exception
{
factory = AuthConfigFactory.getFactory();
factory.registerConfigProvider(new JBossAuthConfigProvider(new HashMap(), null), layer, appId,
"Test Config Provider");
jaspiManager = new JASPIServerAuthenticationManager("conf-jaspi", new JBossCallbackHandler());
SecurityContext jsc = new JBossSecurityContext("conf-jaspi");
SecurityContextAssociation.setSecurityContext(jsc);
XMLLoginConfigImpl xli = XMLLoginConfigImpl.getInstance();
SecurityActions.setJAASConfiguration(xli);
URL configURL = Thread.currentThread().getContextClassLoader().getResource(configFile);
assertNotNull("Config URL", configURL);
xli.setConfigURL(configURL);
xli.loadConfig();
}
示例5: setup
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
@Before
public void setup() {
// NPE fix
if (AuthConfigFactory.getFactory() == null) {
AuthConfigFactory.setFactory(new AuthConfigFactoryImpl());
}
}
示例6: deregisterServerAuthModule
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
/**
* Deregisters the server auth module (and encompassing wrappers/factories) that was previously registered via a call
* to registerServerAuthModule.
*
* @param servletContext the context of the app for which the module is deregistered
*/
public static void deregisterServerAuthModule(ServletContext servletContext) {
String registrationId = (String) servletContext.getAttribute(CONTEXT_REGISTRATION_ID);
if (!isEmpty(registrationId)) {
AuthConfigFactory.getFactory().removeRegistration(registrationId);
}
}
示例7: YubiAuthConfigProvider
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
/**
* Constructor with signature and implementation that's required by API.
*
* @param properties
* @param factory
*/
public YubiAuthConfigProvider(Map<String, String> properties, AuthConfigFactory factory) {
this.providerProperties = properties;
if (factory != null) {
factory.registerConfigProvider(this, null, null, "Auto registration");
}
}
示例8: JBossWSAuthConfigProvider
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
public JBossWSAuthConfigProvider(Properties props, AuthConfigFactory factory)
{
contextProperties = props;
if (factory != null)
{
factory.registerConfigProvider(this, "soap", null, "JBossWS AuthConfigProvider");
}
}
示例9: contextInitialized
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
/**
* <p>
* Registers the configuration into the factory.
* </p>
* {@inheritDoc}
*/
@Override
public void contextInitialized(final ServletContextEvent sce) {
final Map<String, String> options = new HashMap<>();
registration = AuthConfigFactory.getFactory().registerConfigProvider(AuthModuleConfigProvider.class.getName(),
options, "HttpServlet", null, null);
}
示例10: testInitializer
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
@Test
public void testInitializer() throws Exception {
AuthConfigFactory.setFactory(mock(AuthConfigFactory.class));
final Initializer i = new Initializer();
i.contextInitialized(null);
i.contextDestroyed(null);
}
示例11: contextInitialized
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
@Override
public void contextInitialized(final ServletContextEvent sce) {
final Map<String, String> options = new HashMap<>();
options.put(CLIENT_ID, config.getClientId());
options.put(CLIENT_SECRET, config.getClientSecret());
options.put(OpenIdConnectAuthModule.DISABLE_CERTIFICATE_CHECKS_KEY, String.valueOf(config.isCertificateCheckDisabled()));
options.put(OpenIdConnectAuthModule.ISSUER_URI_KEY, config.getIssuerUri().toASCIIString());
final String contextPath = sce.getServletContext()
.getContextPath();
final String rootPath = contextPath + "/";
options.put("cookie_context", rootPath);
options.put("scope", config.getScope());
options.put("redirection_endpoint", contextPath + "/cb");
options.put("logout_redirection_endpoint", contextPath + "/cblogout");
options.put("token_uri", contextPath + "/token");
options.put("userinfo_uri", contextPath + "/userinfo");
// TODO make this dependent on openid configuration
// options.put(OpenIdConnectAuthModule.LOGOUT_GOTO_URI_KEY, rootPath);
options.put(OpenIdConnectAuthModule.LOGOUT_URI_KEY, contextPath + "/logout");
registrationID = AuthConfigFactory.getFactory()
.registerConfigProvider(new OpenIdConnectModuleConfigProvider(options, null), "HttpServlet", getAppContext(sce), null);
Log.fine("registered", registrationID, options);
}
示例12: JBossAuthConfigProvider
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
/**
* 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");
}
示例13: setUp
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
@Override
public void setUp()
{
factory = AuthConfigFactory.getFactory();
factory.registerConfigProvider(new TestAuthConfigProvider(), "TEST", "APP",
"Test Config Provider");
}
示例14: TestAuthConfigProvider
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
/**
* 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");
}
}
示例15: TestAuthConfigProvider
import javax.security.auth.message.config.AuthConfigFactory; //导入依赖的package包/类
/**
* 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");
}
}