aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan <djr2468@gmail.com>2023-04-03 22:22:20 +0100
committerDan <djr2468@gmail.com>2023-04-03 22:22:20 +0100
commitcf992ec194ef8fbcd86ad170bdc68c6075712591 (patch)
tree1a0626c1db0cf02389f6b55bcd9767f232504130
parenta16da3bef30b26cbf813526dee817538b99d9d6e (diff)
downloadtrackermap-server-cf992ec194ef8fbcd86ad170bdc68c6075712591.tar.gz
trackermap-server-cf992ec194ef8fbcd86ad170bdc68c6075712591.tar.bz2
trackermap-server-cf992ec194ef8fbcd86ad170bdc68c6075712591.zip
Block login when openid is forced
-rw-r--r--src/main/java/org/traccar/api/security/LoginService.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/api/security/LoginService.java b/src/main/java/org/traccar/api/security/LoginService.java
index c7482a2e3..db9ed6cff 100644
--- a/src/main/java/org/traccar/api/security/LoginService.java
+++ b/src/main/java/org/traccar/api/security/LoginService.java
@@ -43,6 +43,7 @@ public class LoginService {
private final String serviceAccountToken;
private final boolean forceLdap;
+ private final boolean forceOpenId;
@Inject
public LoginService(
@@ -53,6 +54,7 @@ public class LoginService {
this.ldapProvider = ldapProvider;
serviceAccountToken = config.getString(Keys.WEB_SERVICE_ACCOUNT_TOKEN);
forceLdap = config.getBoolean(Keys.LDAP_FORCE);
+ forceOpenId = config.getBoolean(Keys.OPENID_FORCE);
}
public User login(String token) throws StorageException, GeneralSecurityException, IOException {
@@ -69,6 +71,10 @@ public class LoginService {
}
public User login(String email, String password) throws StorageException {
+ if (forceOpenId) {
+ return null;
+ }
+
email = email.trim();
User user = storage.getObject(User.class, new Request(
new Columns.All(),