Skip to content
This repository was archived by the owner on Jan 20, 2024. It is now read-only.

Commit 1cd8bff

Browse files
authored
fixes #380 refactor with ServerConfig (#381)
1 parent b6fe92a commit 1cd8bff

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

code/src/main/java/com/networknt/oauth/code/PathHandlerProvider.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.networknt.oauth.security.LightGSSAPIAuthenticationMechanism;
2020
import com.networknt.oauth.security.LightIdentityManager;
2121

22+
import com.networknt.server.ServerConfig;
2223
import io.undertow.Handlers;
2324
import io.undertow.security.api.AuthenticationMechanism;
2425
import io.undertow.security.api.AuthenticationMode;
@@ -45,17 +46,16 @@
4546
public class PathHandlerProvider implements HandlerProvider {
4647
private static final String SPNEGO_SERVICE_PASSWORD = "spnegoServicePassword";
4748
private static final String SECRET_CONFIG = "secret";
48-
private static final String SERVER_CONFIG = "server";
4949
private static final Map<String, Object> secret = Config.getInstance().getJsonMapConfig(SECRET_CONFIG);
50-
private static final Map<String, Object> server = Config.getInstance().getJsonMapConfigNoCache(SERVER_CONFIG);
50+
private static final ServerConfig serverConfig = ServerConfig.getInstance();
5151
private static final String spnegoServicePassword = (String)secret.get(SPNEGO_SERVICE_PASSWORD);
5252

5353
@Override
5454
public HttpHandler getHandler() {
5555
final IdentityManager basicIdentityManager = new LightIdentityManager();
5656

5757
HttpHandler handler = Handlers.routing()
58-
.add(Methods.GET, "/health/"+server.get("serviceId"), new HealthGetHandler())
58+
.add(Methods.GET, "/health/" + serverConfig.getServiceId(), new HealthGetHandler())
5959
.add(Methods.GET, "/server/info", new ServerInfoGetHandler())
6060
.add(Methods.GET, "/oauth2/code", addGetSecurity(new Oauth2CodeGetHandler(), basicIdentityManager))
6161
.add(Methods.POST, "/oauth2/code", addFormSecurity(new Oauth2CodePostHandler(), basicIdentityManager))

code/src/main/java/com/networknt/oauth/code/handler/BaseWrapper.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.networknt.oauth.security.LightFormAuthenticationMechanism;
66
import com.networknt.oauth.security.LightGSSAPIAuthenticationMechanism;
77
import com.networknt.oauth.security.LightIdentityManager;
8+
import com.networknt.server.ServerConfig;
89
import io.undertow.security.api.AuthenticationMechanism;
910
import io.undertow.security.api.AuthenticationMode;
1011
import io.undertow.security.api.GSSAPIServerSubjectFactory;
@@ -31,9 +32,7 @@ public class BaseWrapper {
3132

3233
private static final String SPNEGO_SERVICE_PASSWORD = "spnegoServicePassword";
3334
private static final String SECRET_CONFIG = "secret";
34-
private static final String SERVER_CONFIG = "server";
3535
private static final Map<String, Object> secret = Config.getInstance().getJsonMapConfig(SECRET_CONFIG);
36-
private static final Map<String, Object> server = Config.getInstance().getJsonMapConfigNoCache(SERVER_CONFIG);
3736
private static final String spnegoServicePassword = (String)secret.get(SPNEGO_SERVICE_PASSWORD);
3837

3938
final IdentityManager basicIdentityManager = new LightIdentityManager();

0 commit comments

Comments
 (0)