验证方式改成 basic,获取更好的兼容兴

This commit is contained in:
zhouxin 2021-06-01 23:12:04 +08:00
parent 31c0876e58
commit 553d456dc3
1 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,8 @@
package com.github.zxbu.webdavteambition.config;
import org.apache.catalina.authenticator.DigestAuthenticator;
import org.apache.catalina.CredentialHandler;
import org.apache.catalina.authenticator.AuthenticatorBase;
import org.apache.catalina.authenticator.BasicAuthenticator;
import org.apache.catalina.realm.GenericPrincipal;
import org.apache.catalina.realm.MessageDigestCredentialHandler;
import org.apache.catalina.realm.RealmBase;
@ -46,11 +48,11 @@ public class AuthTomcatConfig implements WebServerFactoryCustomizer<Configurable
}
};
MessageDigestCredentialHandler credentialHandler = new MessageDigestCredentialHandler();
CredentialHandler credentialHandler = new MessageDigestCredentialHandler();
realm.setCredentialHandler(credentialHandler);
context.setRealm(realm);
DigestAuthenticator digestAuthenticator = new DigestAuthenticator();
AuthenticatorBase digestAuthenticator = new BasicAuthenticator();
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setAuthConstraint(true);
securityConstraint.addAuthRole("**");