KEYCLOAK-15184: Use static inner class where possible

This commit is contained in:
testn 2020-08-17 10:09:34 +07:00 committed by Hynek Mlnařík
parent 6e713b5044
commit 269a72d672
38 changed files with 41 additions and 41 deletions

View file

@ -232,7 +232,7 @@ public class PolicyEnforcer {
return paths;
}
public class PathConfigMatcher extends PathMatcher<PathConfig> {
public static class PathConfigMatcher extends PathMatcher<PathConfig> {
private final Map<String, PathConfig> paths;
private final PathCache pathCache;

View file

@ -136,7 +136,7 @@ public abstract class AbstractKeycloakJettyAuthenticator extends LoginAuthentica
return new DefaultUserIdentity(theSubject, principal, theRoles);
}
private class DummyLoginService implements LoginService {
private static class DummyLoginService implements LoginService {
@Override
public String getName() {
return null;

View file

@ -149,7 +149,7 @@ public abstract class AbstractSamlAuthenticator extends LoginAuthenticator {
}
private class DummyLoginService implements LoginService {
private static class DummyLoginService implements LoginService {
@Override
public String getName() {
return null;

View file

@ -104,7 +104,7 @@ public class LDAPIdentityStoreRegistry {
}
private class LDAPIdentityStoreContext {
private static class LDAPIdentityStoreContext {
private LDAPIdentityStoreContext(LDAPConfig config, LDAPIdentityStore store) {
this.config = config;

View file

@ -146,7 +146,7 @@ public class InfinispanPublicKeyStorageProviderFactory implements PublicKeyStora
}
}
private class SessionAndKeyHolder {
private static class SessionAndKeyHolder {
private final KeycloakSession session;
private final ArrayList<String> cacheKeys;

View file

@ -61,7 +61,7 @@ public class SessionEventsSenderTransaction extends AbstractKeycloakTransaction
}
private class DCEventContext {
private static class DCEventContext {
private final ClusterProvider.DCNotify dcNotify;
private final SessionClusterEvent event;

View file

@ -179,7 +179,7 @@ public class RemoteCacheInvoker {
}
private class RemoteCacheContext {
private static class RemoteCacheContext {
private final RemoteCache remoteCache;
private final MaxIdleTimeLoader maxIdleTimeLoader;

View file

@ -160,7 +160,7 @@ public class AuthnContextType implements Serializable {
* ref="saml:AuthnContextDecl"/>
* <element ref="saml:AuthnContextDeclRef"/> </choice> </sequence>
*/
public class AuthnContextTypeSequence implements Serializable {
public static class AuthnContextTypeSequence implements Serializable {
private AuthnContextClassRefType classRef;

View file

@ -110,7 +110,7 @@ public class CompositeKeyLocator implements KeyLocator, Iterable<Key> {
return Collections.unmodifiableCollection(res);
}
private class JointKeyIterator implements Iterable<Key> {
private static class JointKeyIterator implements Iterable<Key> {
// based on http://stackoverflow.com/a/34126154/6930869
private final Iterator<Iterable<Key>> iterablesIterator;

View file

@ -435,7 +435,7 @@ public class TransformerUtil {
return null;
}
private class CustomHolder {
private static class CustomHolder {
public Document doc;
public boolean encounteredTextNode = false;

View file

@ -117,7 +117,7 @@ public class SAML2Response {
String authContextDeclRef = JBossSAMLURIConstants.AC_PASSWORD_PROTECTED_TRANSPORT.get();
act.addAuthenticatingAuthority(URI.create(authContextDeclRef));
AuthnContextType.AuthnContextTypeSequence sequence = act.new AuthnContextTypeSequence();
AuthnContextType.AuthnContextTypeSequence sequence = new AuthnContextType.AuthnContextTypeSequence();
sequence.setClassRef(new AuthnContextClassRefType(JBossSAMLURIConstants.AC_PASSWORD.getUri()));
act.setSequence(sequence);

View file

@ -58,7 +58,7 @@ public class SAMLAuthnContextParser extends AbstractStaxSamlAssertionParser<Auth
case AUTHN_CONTEXT_DECL:
Element dom = StaxParserUtil.getDOMElement(xmlEventReader);
AuthnContextDeclType authnContextDecl = new AuthnContextDeclType(dom);
authnContextSequence = target.getSequence() != null ? target.getSequence() : target.new AuthnContextTypeSequence();
authnContextSequence = target.getSequence() != null ? target.getSequence() : new AuthnContextType.AuthnContextTypeSequence();
authnContextSequence.setAuthnContextDecl(authnContextDecl);
target.setSequence(authnContextSequence);
break;
@ -75,7 +75,7 @@ public class SAMLAuthnContextParser extends AbstractStaxSamlAssertionParser<Auth
text = StaxParserUtil.getElementText(xmlEventReader);
AuthnContextClassRefType authnContextClassRef = new AuthnContextClassRefType(URI.create(text));
authnContextSequence = target.getSequence() != null ? target.getSequence() : target.new AuthnContextTypeSequence();
authnContextSequence = target.getSequence() != null ? target.getSequence() : new AuthnContextType.AuthnContextTypeSequence();
authnContextSequence.setClassRef(authnContextClassRef);
target.setSequence(authnContextSequence);

View file

@ -64,7 +64,7 @@ public class StatementUtil {
AuthnContextType authnContext = new AuthnContextType();
AuthnContextClassRefType authnContextClassRef = new AuthnContextClassRefType(URI.create(authnContextClassRefValue));
AuthnContextType.AuthnContextTypeSequence sequence = (authnContext).new AuthnContextTypeSequence();
AuthnContextType.AuthnContextTypeSequence sequence = new AuthnContextType.AuthnContextTypeSequence();
sequence.setClassRef(authnContextClassRef);
authnContext.setSequence(sequence);

View file

@ -97,7 +97,7 @@ public class TimeBasedOTP extends HmacOTP {
this.clock.setCalendar(calendar);
}
private class Clock {
private static class Clock {
private final int interval;
private Calendar calendar;

View file

@ -308,7 +308,7 @@ public class PolicyEvaluationService {
return new CloseableKeycloakIdentity(accessToken, keycloakSession, userSession);
}
public class EvaluationDecisionCollector extends DecisionPermissionCollector {
public static class EvaluationDecisionCollector extends DecisionPermissionCollector {
public EvaluationDecisionCollector(AuthorizationProvider authorizationProvider, ResourceServer resourceServer, AuthorizationRequest request) {
super(authorizationProvider, resourceServer, request);

View file

@ -102,8 +102,8 @@ public class RPTIntrospectionProvider extends AccessTokenIntrospectionProvider {
//todo: we need to avoid creating this class when processing responses. The only reason for that is that
// UMA defines "resource_id" and "resource_scopes" claims but we use "rsid" and "scopes".
// To avoid breaking backward compatiblity we are just responding with all these claims.
public class UmaPermissionRepresentation extends Permission {
// To avoid breaking backward compatibility we are just responding with all these claims.
public static class UmaPermissionRepresentation extends Permission {
public UmaPermissionRepresentation(Permission permission) {
setResourceId(permission.getResourceId());

View file

@ -270,7 +270,7 @@ public class FreeMarkerEmailTemplateProvider implements EmailTemplateProvider {
return sb.toString();
}
protected class EmailTemplate {
protected static class EmailTemplate {
private String subject;
private String textBody;

View file

@ -93,7 +93,7 @@ public class AccountFederatedIdentityBean {
return removeLinkPossible;
}
public class FederatedIdentityEntry implements OrderedModel {
public static class FederatedIdentityEntry implements OrderedModel {
private FederatedIdentityModel federatedIdentityModel;
private final String providerId;

View file

@ -268,7 +268,7 @@ public class DefaultKeyManager implements KeyManager {
return providers;
}
private class ProviderComparator implements Comparator<ComponentModel> {
private static class ProviderComparator implements Comparator<ComponentModel> {
@Override
public int compare(ComponentModel o1, ComponentModel o2) {

View file

@ -1025,7 +1025,7 @@ public class TokenManager {
}
public class RefreshResult {
public static class RefreshResult {
private final AccessTokenResponse response;
private final boolean offlineToken;

View file

@ -1351,7 +1351,7 @@ public class TokenEndpoint {
return codeVerifierEncoded;
}
private class TokenExchangeSamlProtocol extends SamlProtocol {
private static class TokenExchangeSamlProtocol extends SamlProtocol {
final SamlClient samlClient;
TokenExchangeSamlProtocol(SamlClient samlClient) {

View file

@ -75,7 +75,7 @@ public class UserStorageSyncManager {
});
}
private class Holder {
private static class Holder {
ExecutionResult<SynchronizationResult> result;
}

View file

@ -85,7 +85,7 @@ public class FreeMarkerUtil {
return cfg.getTemplate(templateName, "UTF-8");
}
class ThemeTemplateLoader extends URLTemplateLoader {
static class ThemeTemplateLoader extends URLTemplateLoader {
private Theme theme;

View file

@ -127,7 +127,7 @@ public class FileTruststoreProviderFactory implements TruststoreProviderFactory
private class TruststoreCertificatesLoader {
private static class TruststoreCertificatesLoader {
private Map<X500Principal, X509Certificate> trustedRootCerts = new HashMap<>();
private Map<X500Principal, X509Certificate> intermediateCerts = new HashMap<>();

View file

@ -91,7 +91,7 @@ public class DefaultClientValidationProvider implements ClientValidationProvider
}
}
class ValidationException extends Exception {
static class ValidationException extends Exception {
public ValidationException(String message) {
super(message, null, false, false);

View file

@ -89,7 +89,7 @@ public class TestPolicyProviderFactory implements PolicyProviderFactory {
return "test";
}
private class TestPolicyProvider implements PolicyProvider {
private static class TestPolicyProvider implements PolicyProvider {
private final AuthorizationProvider authorization;

View file

@ -378,7 +378,7 @@ public class BackwardsCompatibilityUserStorage implements UserLookupProvider, Us
}
class MyUser {
static class MyUser {
private String username;
private CredentialModel hashedPassword;

View file

@ -315,7 +315,7 @@ public class SimpleUndertowLoadBalancer {
private static final AttachmentKey<Integer> REMAINING_RETRY_ATTEMPTS = AttachmentKey.create(Integer.class);
private class ProxyCallbackDelegate implements ProxyCallback<ProxyConnection> {
private static class ProxyCallbackDelegate implements ProxyCallback<ProxyConnection> {
private final ProxyClient proxyClient;
private final ProxyCallback<ProxyConnection> delegate;

View file

@ -43,7 +43,7 @@ public class TestClassProvider {
server.stop();
}
public class ClassPathResourceManager implements ResourceManager {
public static class ClassPathResourceManager implements ResourceManager {
@Override
public Resource getResource(String className) {

View file

@ -157,7 +157,7 @@ public class LoginForm extends Form {
return getTextFromElement(rememberMeLabel);
}
public class TotpSetupForm extends Form {
public static class TotpSetupForm extends Form {
@FindBy(id = "totp")
private WebElement totpInputField;

View file

@ -62,7 +62,7 @@ public class AdminConsoleRealm extends AdminConsoleRealmsRoot {
// return realmsResource().realm(getConsoleRealm());
// }
public class ConfigureMenu {
public static class ConfigureMenu {
@FindBy(partialLinkText = "Realm Settings")
private WebElement realmSettingsLink;
@ -111,7 +111,7 @@ public class AdminConsoleRealm extends AdminConsoleRealmsRoot {
return manageMenu;
}
public class ManageMenu {
public static class ManageMenu {
@FindBy(partialLinkText = "Users")
private WebElement usersLink;

View file

@ -42,7 +42,7 @@ public class AdminEvents extends Events {
return table;
}
public class AdminEventsTable extends DataTable {
public static class AdminEventsTable extends DataTable {
@FindBy(xpath = "//button[text()[contains(.,'Filter')]]")
private WebElement filterButton;

View file

@ -45,7 +45,7 @@ public class Config extends Events {
return form;
}
public class ConfigForm extends Form {
public static class ConfigForm extends Form {
@FindBy(id = "s2id_autogen1")
private WebElement eventListenersInput;

View file

@ -42,7 +42,7 @@ public class LoginEvents extends Events {
return table;
}
public class LoginEventsTable extends DataTable {
public static class LoginEventsTable extends DataTable {
@FindBy(xpath = "//button[text()[contains(.,'Filter')]]")
private WebElement filterButton;

View file

@ -101,7 +101,7 @@ public class KeycloakWebDriverConfigurator {
}
}
public class KcBrowserCapabilities implements BrowserCapabilities {
public static class KcBrowserCapabilities implements BrowserCapabilities {
private Capabilities capabilitiesToAdd;
private BrowserCapabilities origBrowserCapabilities;

View file

@ -263,7 +263,7 @@ public class KerberosEmbeddedServer extends LDAPEmbeddedServer {
*
* @author Dominik Pospisil <dpospisi@redhat.com>
*/
class NoReplayKdcServer extends KdcServer {
static class NoReplayKdcServer extends KdcServer {
NoReplayKdcServer(KerberosConfig kdcConfig) {
super(kdcConfig);

View file

@ -100,7 +100,7 @@ public class LoadPersistentSessionsCommand extends AbstractCommand {
}
private class MyWorker implements Runnable {
private static class MyWorker implements Runnable {
private final int workerId;
private final int lastCreatedOn;

View file

@ -50,7 +50,7 @@ import org.apache.directory.server.core.api.interceptor.context.SearchOperationC
*/
public class RangedAttributeInterceptor extends BaseInterceptor {
private class RangedEntryFilteringCursor implements EntryFilteringCursor {
private static class RangedEntryFilteringCursor implements EntryFilteringCursor {
private final EntryFilteringCursor c;
private final String name;