aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan <djr2468@gmail.com>2023-04-01 23:10:18 +0100
committerDan <djr2468@gmail.com>2023-04-01 23:10:18 +0100
commit040fa7c83b67b0c6541348c4ecd3979c7a80ebc5 (patch)
tree54e126c501feb0639b50a21ec5be1558b03174c5
parent21abf0f8479c48d8b826dd861f8c1227e6a00e25 (diff)
downloadtrackermap-server-040fa7c83b67b0c6541348c4ecd3979c7a80ebc5.tar.gz
trackermap-server-040fa7c83b67b0c6541348c4ecd3979c7a80ebc5.tar.bz2
trackermap-server-040fa7c83b67b0c6541348c4ecd3979c7a80ebc5.zip
Expose OIDC state on /server endpoint
-rw-r--r--src/main/java/org/traccar/api/security/OpenIDProvider.java2
-rw-r--r--src/main/java/org/traccar/model/Server.java16
2 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/api/security/OpenIDProvider.java b/src/main/java/org/traccar/api/security/OpenIDProvider.java
index cd3fa4dde..80d84dfbd 100644
--- a/src/main/java/org/traccar/api/security/OpenIDProvider.java
+++ b/src/main/java/org/traccar/api/security/OpenIDProvider.java
@@ -61,7 +61,7 @@ import com.nimbusds.openid.connect.sdk.AuthenticationRequest;
import com.nimbusds.openid.connect.sdk.claims.UserInfo;
public class OpenIDProvider {
- private final Boolean force;
+ public final Boolean force;
private final ClientID clientId;
private final Secret clientSecret;
private URI callbackUrl;
diff --git a/src/main/java/org/traccar/model/Server.java b/src/main/java/org/traccar/model/Server.java
index 73645721b..4c6e10b5e 100644
--- a/src/main/java/org/traccar/model/Server.java
+++ b/src/main/java/org/traccar/model/Server.java
@@ -16,13 +16,16 @@
package org.traccar.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+import org.traccar.Main;
+import org.traccar.api.security.OpenIDProvider;
import org.traccar.storage.QueryIgnore;
import org.traccar.storage.StorageName;
@StorageName("tc_servers")
@JsonIgnoreProperties(ignoreUnknown = true)
public class Server extends ExtendedModel implements UserRestrictions {
-
+
private boolean registration;
public boolean getRegistration() {
@@ -261,4 +264,15 @@ public class Server extends ExtendedModel implements UserRestrictions {
this.newServer = newServer;
}
+ @QueryIgnore
+ public boolean getOidcEnabled() {
+ OpenIDProvider oidc = Main.getInjector().getInstance(OpenIDProvider.class);
+ return oidc != null;
+ }
+
+ @QueryIgnore
+ public boolean getOidcForce() {
+ OpenIDProvider oidc = Main.getInjector().getInstance(OpenIDProvider.class);
+ return oidc != null && oidc.force;
+ }
}