From 21abf0f8479c48d8b826dd861f8c1227e6a00e25 Mon Sep 17 00:00:00 2001 From: Dan Date: Sat, 1 Apr 2023 22:53:34 +0100 Subject: Throw API error if oidc disabled --- src/main/java/org/traccar/api/resource/SessionResource.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main/java/org/traccar') diff --git a/src/main/java/org/traccar/api/resource/SessionResource.java b/src/main/java/org/traccar/api/resource/SessionResource.java index ca9f37667..515d7374a 100644 --- a/src/main/java/org/traccar/api/resource/SessionResource.java +++ b/src/main/java/org/traccar/api/resource/SessionResource.java @@ -169,6 +169,10 @@ public class SessionResource extends BaseResource { @Path("openid/auth") @GET public Response openIdAuth() throws IOException { + if (openIdProvider == null) { + throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()); + } + return Response.seeOther( openIdProvider.createAuthRequest() ).build(); @@ -178,6 +182,10 @@ public class SessionResource extends BaseResource { @Path("openid/callback") @GET public Response requestToken() throws IOException, StorageException { + if (openIdProvider == null) { + throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()); + } + // Get full request URI StringBuilder requestURL = new StringBuilder(request.getRequestURL().toString()); String queryString = request.getQueryString(); -- cgit v1.2.3