本文整理汇总了Java中javax.security.auth.message.module.ServerAuthModule类的典型用法代码示例。如果您正苦于以下问题:Java ServerAuthModule类的具体用法?Java ServerAuthModule怎么用?Java ServerAuthModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerAuthModule类属于javax.security.auth.message.module包,在下文中一共展示了ServerAuthModule类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: registerServerAuthModule
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的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;
}
开发者ID:rdebusscher,项目名称:octopus-jsr375,代码行数:29,代码来源:Jaspic.java
示例2: DefaultServerAuthConfig
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
public DefaultServerAuthConfig(String layer, String appContext, CallbackHandler handler,
Map<String, String> providerProperties, ServerAuthModule serverAuthModule) {
this.layer = layer;
this.appContext = appContext;
this.handler = handler;
this.providerProperties = providerProperties;
this.serverAuthModule = serverAuthModule;
}
开发者ID:rdebusscher,项目名称:octopus-jsr375,代码行数:9,代码来源:DefaultServerAuthConfig.java
示例3: createSAM
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
@SuppressWarnings(
{"unchecked", "rawtypes"})
private ServerAuthModule createSAM(ClassLoader moduleCL, String name) throws Exception
{
Class clazz = SecurityActions.loadClass(moduleCL, name);
Constructor ctr = clazz.getConstructor(new Class[0]);
return (ServerAuthModule) ctr.newInstance(new Object[0]);
}
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:9,代码来源:JBossWSServerAuthConfig.java
示例4: testSecureMessage
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
@Test
public void testSecureMessage() throws Exception {
final Subject subject = new Subject();
final Principal groupPrincipal = mock(Principal.class);
when(groupPrincipal.getName()).thenReturn("authenticated");
subject.getPrincipals().add(groupPrincipal);
final Principal userPrincipal = mock(Principal.class);
when(userPrincipal.getName()).thenReturn("https://[email protected]");
subject.getPrincipals().add(userPrincipal);
final MessageInfo messageInfo = mock(MessageInfo.class);
final HttpSession session = mock(HttpSession.class);
when(session.getAttribute("X-Subject")).thenReturn("https://[email protected]");
when(session.getAttribute("X-Nonce")).thenReturn("abc");
final HttpServletRequest servletRequest = mock(HttpServletRequest.class);
when(servletRequest.getMethod()).thenReturn("POST");
when(servletRequest.isSecure()).thenReturn(true);
when(servletRequest.getRequestURI()).thenReturn("/util/secure_page");
when(servletRequest.getContextPath()).thenReturn("/util");
when(servletRequest.getSession()).thenReturn(session);
when(servletRequest.getSession(false)).thenReturn(session);
when(messageInfo.getRequestMessage()).thenReturn(servletRequest);
final CallbackHandler h = mock(CallbackHandler.class);
final ServerAuthModule sam = new TestServerAuthModule();
final MessagePolicy mockRequestPolicy = mock(MessagePolicy.class);
when(mockRequestPolicy.isMandatory()).thenReturn(true);
sam.initialize(mockRequestPolicy, null, h, options);
assertEquals(AuthStatus.SUCCESS, sam.validateRequest(messageInfo, null, subject));
}
开发者ID:trajano,项目名称:jaspic-tester,代码行数:40,代码来源:TestServerAuthModuleTest.java
示例5: testSecureMessage
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
@Test
public void testSecureMessage() throws Exception {
final Subject subject = new Subject();
final Principal groupPrincipal = mock(Principal.class);
when(groupPrincipal.getName()).thenReturn("authenticated");
subject.getPrincipals().add(groupPrincipal);
final Principal userPrincipal = mock(Principal.class);
when(userPrincipal.getName()).thenReturn("https://[email protected]");
subject.getPrincipals().add(userPrincipal);
final MessageInfo messageInfo = mock(MessageInfo.class);
final Cookie[] cookies = new Cookie[] {
new Cookie("X-Subject", "https://[email protected]"),
new Cookie("not-relevant", "foo")
};
final HttpServletRequest servletRequest = mock(HttpServletRequest.class);
when(servletRequest.getMethod()).thenReturn("POST");
when(servletRequest.isSecure()).thenReturn(true);
when(servletRequest.getRequestURI()).thenReturn("/util/secure_page");
when(servletRequest.getContextPath()).thenReturn("/util");
when(servletRequest.getCookies()).thenReturn(cookies);
when(messageInfo.getRequestMessage()).thenReturn(servletRequest);
final CallbackHandler h = mock(CallbackHandler.class);
final ServerAuthModule sam = new TestServerAuthModule();
final MessagePolicy mockRequestPolicy = mock(MessagePolicy.class);
when(mockRequestPolicy.isMandatory()).thenReturn(true);
sam.initialize(mockRequestPolicy, null, h, options);
assertEquals(AuthStatus.SUCCESS, sam.validateRequest(messageInfo, null, subject));
}
开发者ID:trajano,项目名称:jaspic-tester,代码行数:39,代码来源:TestServerAuthModuleTest.java
示例6: createSAM
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
@SuppressWarnings({"rawtypes", "unchecked"})
private ServerAuthModule createSAM(ClassLoader moduleCL, String name )
throws Exception
{
Class clazz = SecurityActions.loadClass(moduleCL, name);
Constructor ctr = clazz.getConstructor(new Class[0]);
return (ServerAuthModule) ctr.newInstance(new Object[0]);
}
开发者ID:picketbox,项目名称:picketbox,代码行数:9,代码来源:JBossServerAuthConfig.java
示例7: JBossServerAuthContext
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
public JBossServerAuthContext(List<ServerAuthModule> modules,
Map<String,Map> moduleNameToOptions, CallbackHandler cbh) throws AuthException
{
this.modules = modules;
this.moduleOptionsByName = moduleNameToOptions;
for(ServerAuthModule sam:modules)
{
sam.initialize(null, null, cbh,
moduleOptionsByName.get(sam.getClass().getName()));
}
}
开发者ID:picketbox,项目名称:picketbox,代码行数:12,代码来源:JBossServerAuthContext.java
示例8: cleanSubject
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
/**
* @see ServerAuthContext#cleanSubject(javax.security.auth.message.MessageInfo, javax.security.auth.Subject)
*/
public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException
{
for(ServerAuthModule sam:modules)
{
sam.cleanSubject(messageInfo, subject);
}
}
开发者ID:picketbox,项目名称:picketbox,代码行数:11,代码来源:JBossServerAuthContext.java
示例9: secureResponse
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
/**
* @see ServerAuthContext#secureResponse(javax.security.auth.message.MessageInfo, javax.security.auth.Subject)
*/
public AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject) throws AuthException
{
AuthStatus status = null;
for(ServerAuthModule sam:modules)
{
status = sam.secureResponse(messageInfo, serviceSubject);
}
return status;
}
开发者ID:picketbox,项目名称:picketbox,代码行数:13,代码来源:JBossServerAuthContext.java
示例10: validateRequest
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
/**
* @see ServerAuthContext#validateRequest(javax.security.auth.message.MessageInfo, javax.security.auth.Subject, javax.security.auth.Subject)
*/
public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject,
Subject serviceSubject) throws AuthException
{
List<ServerAuthModule> supportingModules = new ArrayList<ServerAuthModule>();
Class requestType = messageInfo.getRequestMessage().getClass();
Class[] requestInterfaces = requestType.getInterfaces();
List<Class> intfaee = Arrays.asList(requestInterfaces);
for(ServerAuthModule sam:modules)
{
List<Class> supportedTypes = Arrays.asList(sam.getSupportedMessageTypes());
//Check the interfaces
for(Class clazz:intfaee)
{
if(supportedTypes.contains(clazz) && !supportingModules.contains(sam))
supportingModules.add(sam);
}
//Check the class type also
if((supportedTypes.contains(Object.class) || supportedTypes.contains(requestType))
&& !supportingModules.contains(sam))
supportingModules.add(sam);
}
if(supportingModules.size() == 0)
throw PicketBoxMessages.MESSAGES.noServerAuthModuleForRequestType(requestType);
AuthStatus authStatus = invokeModules(messageInfo, clientSubject, serviceSubject);
return authStatus;
}
开发者ID:picketbox,项目名称:picketbox,代码行数:36,代码来源:JBossServerAuthContext.java
示例11: TestServerAuthConfig
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
public TestServerAuthConfig(String layer, String appContext, CallbackHandler handler,
Map<String, String> providerProperties, ServerAuthModule serverAuthModule) {
this.layer = layer;
this.appContext = appContext;
this.handler = handler;
this.providerProperties = providerProperties;
this.serverAuthModule = serverAuthModule;
}
开发者ID:ftomassetti,项目名称:JavaIncrementalParser,代码行数:9,代码来源:TestServerAuthConfig.java
示例12: TestServerAuthConfig
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
public TestServerAuthConfig(String layer, String appContext, CallbackHandler handler, Map<String, String> providerProperties, ServerAuthModule serverAuthModule) {
this.layer = layer;
this.appContext = appContext;
this.handler = handler;
this.providerProperties = providerProperties;
this.serverAuthModule = serverAuthModule;
}
开发者ID:arjantijms,项目名称:jaspic-capabilities-test,代码行数:8,代码来源:TestServerAuthConfig.java
示例13: TheServerAuthConfig
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
public TheServerAuthConfig(String layer, String appContext, CallbackHandler handler,
Map<String, String> providerProperties, ServerAuthModule serverAuthModule) {
this.layer = layer;
this.appContext = appContext;
this.handler = handler;
this.providerProperties = providerProperties;
this.serverAuthModule = serverAuthModule;
}
开发者ID:apache,项目名称:tomee,代码行数:9,代码来源:TheServerAuthConfig.java
示例14: DefaultServerAuthContext
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
public DefaultServerAuthContext(CallbackHandler handler, ServerAuthModule serverAuthModule) throws AuthException {
this.serverAuthModule = serverAuthModule;
serverAuthModule.initialize(null, null, handler, Collections.<String, String>emptyMap());
}
开发者ID:rdebusscher,项目名称:octopus-jsr375,代码行数:5,代码来源:DefaultServerAuthContext.java
示例15: DefaultAuthConfigProvider
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
public DefaultAuthConfigProvider(ServerAuthModule serverAuthModule) {
this.serverAuthModule = serverAuthModule;
}
开发者ID:rdebusscher,项目名称:octopus-jsr375,代码行数:4,代码来源:DefaultAuthConfigProvider.java
示例16: setDelegateClass
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
/**
* Set the class of delegate to use
* @param delegateClass the class of delegate to use
*/
public synchronized static void setDelegateClass(
Class<? extends ServerAuthModule> delegateClass)
{
DefaultSAM.delegateClass = delegateClass;
}
开发者ID:josmas,项目名称:openwonderland,代码行数:10,代码来源:DefaultSAM.java
示例17: initialize
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
public void initialize(WonderlandAppServer was) {
Class<? extends ServerAuthModule> delegate =
WonderSAM.class.asSubclass(ServerAuthModule.class);
DefaultSAM.setDelegateClass(delegate);
}
开发者ID:josmas,项目名称:openwonderland,代码行数:6,代码来源:SecurityWebLibPlugin.java
示例18: JBossWSServerAuthContext
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
public JBossWSServerAuthContext(List<ServerAuthModule> modules, Map<String, Map> moduleNameToOptions,
CallbackHandler cbh) throws AuthException
{
super(modules, moduleNameToOptions, cbh);
}
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:6,代码来源:JBossWSServerAuthContext.java
示例19: invokeModules
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
private AuthStatus invokeModules(MessageInfo messageInfo,
Subject clientSubject, Subject serviceSubject)
throws AuthException
{
//Control Flag behavior
boolean encounteredRequiredError = false;
boolean encounteredOptionalError = false;
AuthException moduleException = null;
AuthStatus overallDecision = AuthStatus.FAILURE;
int length = modules.size();
for(int i = 0; i < length; i++)
{
ServerAuthModule module = (ServerAuthModule)modules.get(i);
ControlFlag flag = (ControlFlag)this.controlFlags.get(i);
AuthStatus decision = AuthStatus.FAILURE;
try
{
decision = module.validateRequest(messageInfo, clientSubject, serviceSubject);
}
catch(Exception ae)
{
decision = AuthStatus.FAILURE;
if(moduleException == null)
moduleException = new AuthException(ae.getMessage());
}
if(decision == AuthStatus.SUCCESS)
{
overallDecision = AuthStatus.SUCCESS;
//SUFFICIENT case
if(flag == ControlFlag.SUFFICIENT && encounteredRequiredError == false)
return AuthStatus.SUCCESS;
continue; //Continue with the other modules
}
//Go through the failure cases
//REQUISITE case
if(flag == ControlFlag.REQUISITE)
{
if(moduleException == null)
moduleException = new AuthException(PicketBoxMessages.MESSAGES.authenticationFailedMessage());
else
throw moduleException;
}
//REQUIRED Case
if(flag == ControlFlag.REQUIRED)
{
if(encounteredRequiredError == false)
encounteredRequiredError = true;
}
if(flag == ControlFlag.OPTIONAL)
encounteredOptionalError = true;
}
//All the authorization modules have been visited.
String msg = getAdditionalErrorMessage(moduleException);
if(encounteredRequiredError)
throw new AuthException(PicketBoxMessages.MESSAGES.authenticationFailedMessage() + msg);
if(overallDecision == AuthStatus.FAILURE && encounteredOptionalError)
throw new AuthException(PicketBoxMessages.MESSAGES.authenticationFailedMessage() + msg);
if(overallDecision == AuthStatus.FAILURE)
throw new AuthException(PicketBoxMessages.MESSAGES.authenticationFailedMessage());
return AuthStatus.SUCCESS;
}
开发者ID:picketbox,项目名称:picketbox,代码行数:65,代码来源:JBossServerAuthContext.java
示例20: TestServerAuthContext
import javax.security.auth.message.module.ServerAuthModule; //导入依赖的package包/类
public TestServerAuthContext(CallbackHandler handler, ServerAuthModule serverAuthModule) throws AuthException {
this.serverAuthModule = serverAuthModule;
serverAuthModule.initialize(null, null, handler, Collections.<String, String> emptyMap());
}
开发者ID:ftomassetti,项目名称:JavaIncrementalParser,代码行数:5,代码来源:TestServerAuthContext.java
注:本文中的javax.security.auth.message.module.ServerAuthModule类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论