Skip to content

Package: DisabledLocator

DisabledLocator

nameinstructionbranchcomplexitylinemethod
close()
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getProcessor()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getService()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 13 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2017, 2022 Red Hat Inc and others.
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Red Hat Inc - initial API and implementation
12: * Eurotech
13: *******************************************************************************/
14: package org.eclipse.kapua.plugin.sso.openid.provider.internal;
15:
16: import org.eclipse.kapua.plugin.sso.openid.JwtProcessor;
17: import org.eclipse.kapua.plugin.sso.openid.OpenIDService;
18: import org.eclipse.kapua.plugin.sso.openid.provider.OpenIDProvider.ProviderLocator;
19: import org.jose4j.jwt.consumer.JwtContext;
20:
21: import javax.json.JsonObject;
22: import java.net.URI;
23:
24: /**
25: * A dummy locator to return when the providerId (on the ProviderOpenIDLocator) is null.
26: */
27: public class DisabledLocator implements ProviderLocator {
28:
29: public static final ProviderLocator INSTANCE = new DisabledLocator();
30:
31: private static final OpenIDService SERVICE = new OpenIDService() {
32:
33: @Override
34: public boolean isEnabled() {
35: return false;
36: }
37:
38: @Override
39: public String getLoginUri(final String state, final URI redirectUri) {
40: return null;
41: }
42:
43: @Override
44: public String getLogoutUri(String idTokenHint, URI postLogoutRedirectUri, String state) {
45: return null;
46: }
47:
48: @Override
49: public JsonObject getTokens(final String authCode, final URI redirectUri) {
50: return null;
51: }
52:
53: @Override
54: public JsonObject getUserInfo(String authCode) {
55: return null;
56: }
57: };
58:
59: /**
60: * A dummy JwtProcessor.
61: */
62: private static final JwtProcessor PROCESSOR = new JwtProcessor() {
63:
64: @Override
65: public void close() throws Exception {
66:
67: }
68:
69: @Override
70: public boolean validate(String jwt) {
71: return false;
72: }
73:
74: @Override
75: public JwtContext process(String jwt) {
76: return null;
77: }
78:
79: @Override
80: public String getExternalIdClaimName() {
81: return null;
82: }
83:
84: @Override
85: public String getExternalUsernameClaimName() {
86: return null;
87: }
88: };
89:
90: private DisabledLocator() {
91: }
92:
93: @Override
94: public OpenIDService getService() {
95: return SERVICE;
96: }
97:
98: @Override
99: public JwtProcessor getProcessor() {
100: return PROCESSOR;
101: }
102:
103: @Override
104: public void close() throws Exception {
105: }
106: }