本文整理汇总了Java中io.undertow.security.api.AuthenticationMechanism类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationMechanism类的具体用法?Java AuthenticationMechanism怎么用?Java AuthenticationMechanism使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationMechanism类属于io.undertow.security.api包,在下文中一共展示了AuthenticationMechanism类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSecurityHandlerChain
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
private static PipedHttpHandler getSecurityHandlerChain(final PipedHttpHandler next, AuthenticationMechanism authenticationMechanism, final IdentityManager identityManager, final AccessManager accessManager, final boolean challenging) {
if (identityManager != null) {
final List<AuthenticationMechanism> mechanisms = new ArrayList<>();
if(authenticationMechanism != null){
mechanisms.add(authenticationMechanism);
}
mechanisms.add(new AuthTokenAuthenticationMechanism(RESTHEART_REALM));
if (challenging) {
mechanisms.add(new BasicAuthenticationMechanism(RESTHEART_REALM));
} else {
mechanisms.add(new SilentBasicAuthenticationMechanism(RESTHEART_REALM));
}
return buildSecurityHandlerChain(next, accessManager, identityManager, mechanisms);
} else {
return next;
}
}
示例2: loadAuthenticationMechanism
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
/**
* loadAuthenticationMechanism
*
* @return the AuthenticationMechanism
*/
private static AuthenticationMechanism loadAuthenticationMechanism(final IdentityManager identityManager) {
AuthenticationMechanism authMechanism = null;
if (configuration.getAuthMechanism() != null) {
try {
AuthenticationMechanismFactory am = (AuthenticationMechanismFactory) Class.forName(configuration.getAuthMechanism())
.getConstructor()
.newInstance();
authMechanism = am.build(configuration.getAuthMechanismArgs(), identityManager);
LOGGER.info("Authentication Mechanism {} enabled", configuration.getAuthMechanism());
} catch (ClassNotFoundException
| IllegalAccessException
| IllegalArgumentException
| InstantiationException
| NoSuchMethodException
| SecurityException
| InvocationTargetException ex) {
logErrorAndExit("Error configuring Authentication Mechanism implementation " + configuration.getAuthMechanism(), ex, false, -3);
}
} else {
LOGGER.info("Authentication Mechanism io.undertow.security.impl.BasicAuthenticationMechanism enabled");
}
return authMechanism;
}
示例3: handleRequest
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
final SecurityContext sc = exchange.getSecurityContext();
if(sc != null) {
for(AuthenticationMechanism mechanism : authenticationMechanisms) {
sc.addAuthenticationMechanism(mechanism);
}
}
next.handleRequest(exchange);
}
示例4: transition
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
private AuthenticationState transition() {
if (mechanismIterator.hasNext()) {
final AuthenticationMechanism mechanism = mechanismIterator.next();
AuthenticationMechanismOutcome outcome = mechanism.authenticate(exchange, SecurityContextImpl.this);
if (outcome == null) {
throw UndertowMessages.MESSAGES.authMechanismOutcomeNull();
}
switch (outcome) {
case AUTHENTICATED:
// TODO - Should verify that the mechanism did register an authenticated Account.
return AuthenticationState.AUTHENTICATED;
case NOT_AUTHENTICATED:
// A mechanism attempted to authenticate but could not complete, this now means that
// authentication is required and challenges need to be sent.
setAuthenticationRequired();
return AuthenticationState.ATTEMPTED;
case NOT_ATTEMPTED:
// Time to try the next mechanism.
return transition();
default:
throw new IllegalStateException();
}
} else {
// Reached the end of the mechanisms and no mechanism authenticated for us to reach this point.
return AuthenticationState.ATTEMPTED;
}
}
示例5: create
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
@Override
public AuthenticationMechanism create(String mechanismName, FormParserFactory formParserFactory, Map<String, String> properties) {
// <auth-method>BASIC?silent=true,FORM</auth-method>
// "When adding the mechanism name to the LoginConfig structure it
// is also possible to specify a property map."
String realm = properties.get(REALM);
// String contextPath = properties.get(CONTEXT_PATH);
Optional<Realm> realmProviders = oidc.listRealms().stream().filter(r -> realm.equals(r.getName())).findFirst();
if (realmProviders.isPresent()) {
return new OIDCAuthenticationMechanism(mechanismName, realmProviders.get(), oidc.getContext(), formParserFactory, identityManager);
} else {
throw new RuntimeException(String.format("Unable to find realm configuration for %s", realm));
}
}
示例6: mechanism
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
private AuthenticationMechanism mechanism(final boolean opera, final boolean digest) {
if (digest) {
return opera ? fakeRealmdigestMechanism : digestMechanism;
} else {
return opera ? fakeRealmBasicMechanism : basicMechanism;
}
}
示例7: buildSecurityHandlerChain
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
protected static PipedHttpHandler buildSecurityHandlerChain(
PipedHttpHandler next,
final AccessManager accessManager,
final IdentityManager identityManager,
final List<AuthenticationMechanism> mechanisms) {
PipedHttpHandler handler;
if (accessManager == null) {
throw new IllegalArgumentException("Error, accessManager cannot "
+ "be null. "
+ "Eventually use FullAccessManager "
+ "that gives full access power ");
}
handler = new AuthTokenInjecterHandler(
new AccessManagerHandler(accessManager, next));
handler = new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE,
identityManager,
new AuthenticationMechanismsHandler(
new AuthenticationConstraintHandler(
new AuthenticationCallHandler(handler),
accessManager),
mechanisms));
return handler;
}
示例8: AuthenticationMechanismsHandler
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
public AuthenticationMechanismsHandler(final HttpHandler next, final List<AuthenticationMechanism> authenticationMechanisms) {
this.next = next;
this.authenticationMechanisms = authenticationMechanisms;
}
示例9: addAuthenticationMechanism
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
@Override
public void addAuthenticationMechanism(final AuthenticationMechanism handler) {
// TODO - Do we want to change this so we can ensure the mechanisms are not modifiable mid request?
authMechanisms.add(handler);
}
示例10: getAuthenticationMechanisms
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
@Override
public List<AuthenticationMechanism> getAuthenticationMechanisms() {
return Collections.unmodifiableList(authMechanisms);
}
示例11: AuthAttempter
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
private AuthAttempter(final Iterator<AuthenticationMechanism> mechanismIterator, final HttpServerExchange exchange) {
this.mechanismIterator = mechanismIterator;
this.exchange = exchange;
}
示例12: ChallengeSender
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
private ChallengeSender(final Iterator<AuthenticationMechanism> mechanismIterator, final HttpServerExchange exchange) {
this.mechanismIterator = mechanismIterator;
this.exchange = exchange;
}
示例13: create
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
@Override
public AuthenticationMechanism create(String mechanismName, FormParserFactory formParserFactory, Map<String, String> properties) {
return new ExternalAuthenticationMechanism(mechanismName);
}
示例14: create
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
@Override
public AuthenticationMechanism create(String mechanismName, FormParserFactory formParserFactory, Map<String, String> properties) {
String realm = properties.get(REALM);
String silent = properties.get(SILENT);
return new BasicAuthenticationMechanism(realm, mechanismName, silent != null && silent.equals("true"));
}
示例15: create
import io.undertow.security.api.AuthenticationMechanism; //导入依赖的package包/类
@Override
public AuthenticationMechanism create(String mechanismName, FormParserFactory formParserFactory, Map<String, String> properties) {
String forceRenegotiation = properties.get(FORCE_RENEGOTIATION);
return new ClientCertAuthenticationMechanism(mechanismName, forceRenegotiation == null ? true : "true".equals(forceRenegotiation));
}