本文整理汇总了Java中io.undertow.servlet.api.LoginConfig类的典型用法代码示例。如果您正苦于以下问题:Java LoginConfig类的具体用法?Java LoginConfig怎么用?Java LoginConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoginConfig类属于io.undertow.servlet.api包,在下文中一共展示了LoginConfig类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postProcess
import io.undertow.servlet.api.LoginConfig; //导入依赖的package包/类
@Override
public void postProcess(BootContext context) {
boolean statelessAuth = statelessAuth(context);
DeploymentInfo deploymentInfo = context.deploymentInfo();
deploymentInfo.addAuthenticationMechanism(RestAuthenticationMechanism.MECHANISM_NAME, (name, formParserFactory,
properties) -> new RestAuthenticationMechanism(statelessAuth, context.getService(UserRepository.class)));
LoginConfig loginConfig = new LoginConfig(RestAuthenticationMechanism.MECHANISM_NAME, "vas-db-realm");
deploymentInfo.setLoginConfig(loginConfig);
deploymentInfo.setIdentityManager(context.getService(IdentityManager.class));
deploymentInfo.addSecurityConstraint(new SecurityConstraint().addRoleAllowed(User.ROLE).addWebResourceCollection(
new WebResourceCollection().addUrlPattern("/*")));
logoutServlet(context, deploymentInfo);
}
示例2: configureAuth
import io.undertow.servlet.api.LoginConfig; //导入依赖的package包/类
public void configureAuth(DeploymentInfo servletBuilder, ServerOptions serverOptions) {
String realm = serverOptions.getServerName() + " Realm";
log.debug("Enabling Basic Auth: " + realm);
for(Entry<String,String> userNpass : serverOptions.getBasicAuth().entrySet()) {
addUser(userNpass.getKey(), userNpass.getValue(), "role1");
log.debug(String.format("User:%s password:%s",userNpass.getKey(),userNpass.getValue()));
}
LoginConfig loginConfig = new LoginConfig(realm);
Map<String, String> props = new HashMap<>();
props.put("charset", "ISO_8859_1");
props.put("user-agent-charsets", "Chrome,UTF-8,OPR,UTF-8");
loginConfig.addFirstAuthMethod(new AuthMethodConfig("BASIC", props));
servletBuilder.setIdentityManager(this).setLoginConfig(loginConfig);
// TODO: see if we can leverage this stuff
//addConstraints(servletBuilder, serverOptions);
}
示例3: configureDeploymentSecurity
import io.undertow.servlet.api.LoginConfig; //导入依赖的package包/类
private void configureDeploymentSecurity(DeploymentInfo deploymentInfo) {
deploymentInfo.setIdentityManager(identityManager);
deploymentInfo.setLoginConfig(new LoginConfig(HttpServletRequest.BASIC_AUTH, "lightblueRealm"));
deploymentInfo.addSecurityConstraint(new SecurityConstraint()
.addWebResourceCollection(new WebResourceCollection().addUrlPattern("/*"))
.addRoleAllowed(SECURITY_ROLE_AUTHENTICATED));
deploymentInfo.addSecurityRole(SECURITY_ROLE_AUTHENTICATED);
}
示例4: loginConfig
import io.undertow.servlet.api.LoginConfig; //导入依赖的package包/类
public static LoginConfig loginConfig(String realmName, String loginPage, String errorPage) {
return new LoginConfig(realmName, loginPage, errorPage);
}