Skip to content
Snippets Groups Projects
Commit cd64117c authored by srosse's avatar srosse
Browse files

OO-3131: remove authentication for WebDAV if the email / institutional email is null or empty

parent 6b50124a
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing;
import org.olat.core.util.Encoder;
import org.olat.core.util.Encoder.Algorithm;
import org.olat.core.util.StringHelper;
import org.olat.login.LoginModule;
import org.olat.login.auth.AuthenticationSPI;
import org.olat.login.auth.OLATAuthManager;
......@@ -173,12 +174,12 @@ public class WebDAVAuthManager implements AuthenticationSPI {
private void updateWebdavPassword(Identity doer, Identity identity, String password, List<Authentication> authentications) {
updateWebDAVPassword(doer, identity, identity.getName(), password, PROVIDER_WEBDAV, authentications);
if(identity.getUser().getEmail() != null) {
if(StringHelper.containsNonWhitespace(identity.getUser().getEmail())) {
updateWebDAVPassword(doer, identity, identity.getUser().getEmail(), password, PROVIDER_WEBDAV_EMAIL, authentications);
} else {
removePassword(PROVIDER_WEBDAV_EMAIL, authentications);
}
if(identity.getUser().getInstitutionalEmail() != null) {
if(StringHelper.containsNonWhitespace(identity.getUser().getInstitutionalEmail())) {
updateWebDAVPassword(doer, identity, identity.getUser().getInstitutionalEmail(), password, PROVIDER_WEBDAV_INSTITUTIONAL_EMAIL, authentications);
} else {
removePassword(PROVIDER_WEBDAV_INSTITUTIONAL_EMAIL, authentications);
......@@ -223,12 +224,12 @@ public class WebDAVAuthManager implements AuthenticationSPI {
private void updateDigestPasswords(Identity doer, Identity identity, String newPwd,
List<Authentication> authentications) {
updateDigestPassword(doer, identity, identity.getName(), newPwd, PROVIDER_HA1, authentications);
if(identity.getUser().getEmail() != null) {
if(StringHelper.containsNonWhitespace(identity.getUser().getEmail())) {
updateDigestPassword(doer, identity, identity.getUser().getEmail(), newPwd, PROVIDER_HA1_EMAIL, authentications);
} else {
removePassword(PROVIDER_HA1_EMAIL, authentications);
}
if(identity.getUser().getInstitutionalEmail() != null) {
if(StringHelper.containsNonWhitespace(identity.getUser().getInstitutionalEmail())) {
updateDigestPassword(doer, identity, identity.getUser().getInstitutionalEmail(), newPwd, PROVIDER_HA1_INSTITUTIONAL_EMAIL, authentications);
} else {
removePassword(PROVIDER_HA1_INSTITUTIONAL_EMAIL, authentications);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment