diff --git a/core/src/main/java/org/keycloak/AbstractOAuthClient.java b/core/src/main/java/org/keycloak/AbstractOAuthClient.java index 9f082e9f24..bf33ae3e9e 100755 --- a/core/src/main/java/org/keycloak/AbstractOAuthClient.java +++ b/core/src/main/java/org/keycloak/AbstractOAuthClient.java @@ -12,7 +12,9 @@ import java.util.concurrent.atomic.AtomicLong; * @version $Revision: 1 $ */ public class AbstractOAuthClient { - public static final String OAUTH_TOKEN_REQUEST_STATE = "OAuth_Token_Request_State"; + private static final String OAUTH_TOKEN_REQUEST_STATE = "OAuth_Token_Request_State"; + private final AtomicLong counter = new AtomicLong(); + protected String clientId; protected Map credentials; protected String authUrl; @@ -23,8 +25,6 @@ public class AbstractOAuthClient { protected String stateCookiePath; protected boolean isSecure; protected boolean publicClient; - protected final AtomicLong counter = new AtomicLong(); - protected String getStateCode() { return counter.getAndIncrement() + "/" + UUID.randomUUID().toString(); } diff --git a/core/src/main/java/org/keycloak/jose/jws/crypto/HMACProvider.java b/core/src/main/java/org/keycloak/jose/jws/crypto/HMACProvider.java index 00c6a308ef..f73f14e9da 100755 --- a/core/src/main/java/org/keycloak/jose/jws/crypto/HMACProvider.java +++ b/core/src/main/java/org/keycloak/jose/jws/crypto/HMACProvider.java @@ -15,7 +15,7 @@ import java.security.NoSuchAlgorithmException; * @version $Revision: 1 $ */ public class HMACProvider { - public static String getJavaAlgorithm(Algorithm alg) { + private static String getJavaAlgorithm(Algorithm alg) { switch (alg) { case HS256: return "HMACSHA256"; @@ -28,7 +28,7 @@ public class HMACProvider { } } - public static Mac getMAC(final Algorithm alg) { + private static Mac getMAC(final Algorithm alg) { try { return Mac.getInstance(getJavaAlgorithm(alg)); diff --git a/core/src/main/java/org/keycloak/representations/idm/ErrorRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/ErrorRepresentation.java index 3b0aac1b17..1bfd9a0521 100644 --- a/core/src/main/java/org/keycloak/representations/idm/ErrorRepresentation.java +++ b/core/src/main/java/org/keycloak/representations/idm/ErrorRepresentation.java @@ -4,7 +4,7 @@ package org.keycloak.representations.idm; * @author Stian Thorgersen */ public class ErrorRepresentation { - public String errorMessage; + private String errorMessage; public ErrorRepresentation() { } diff --git a/core/src/main/java/org/keycloak/util/Encode.java b/core/src/main/java/org/keycloak/util/Encode.java index 341f0dfc0c..0f3de011bb 100755 --- a/core/src/main/java/org/keycloak/util/Encode.java +++ b/core/src/main/java/org/keycloak/util/Encode.java @@ -268,7 +268,7 @@ public class Encode return buf.toString(); } - public static boolean savePathParams(String segment, StringBuffer newSegment, List params) + private static boolean savePathParams(String segment, StringBuffer newSegment, List params) { boolean foundParam = false; // Regular expressions can have '{' and '}' characters. Replace them to do match @@ -293,7 +293,7 @@ public class Encode * @param encoding * @return */ - public static String encodeValue(String segment, String[] encoding) + private static String encodeValue(String segment, String[] encoding) { ArrayList params = new ArrayList(); boolean foundParam = false; @@ -395,7 +395,7 @@ public class Encode return encodeFromArray(nameOrValue, queryNameValueEncoding, true); } - protected static String encodeFromArray(String segment, String[] encodingMap, boolean encodePercent) + private static String encodeFromArray(String segment, String[] encodingMap, boolean encodePercent) { StringBuffer result = new StringBuffer(); for (int i = 0; i < segment.length(); i++) @@ -445,7 +445,7 @@ public class Encode return encoded; } - public static String pathParamReplacement(String segment, List params) + private static String pathParamReplacement(String segment, List params) { StringBuffer newSegment = new StringBuffer(); Matcher matcher = PARAM_REPLACEMENT.matcher(segment); diff --git a/core/src/main/java/org/keycloak/util/KeycloakUriBuilder.java b/core/src/main/java/org/keycloak/util/KeycloakUriBuilder.java index 27eb3809f8..a1bed7b643 100755 --- a/core/src/main/java/org/keycloak/util/KeycloakUriBuilder.java +++ b/core/src/main/java/org/keycloak/util/KeycloakUriBuilder.java @@ -55,8 +55,8 @@ public class KeycloakUriBuilder { return impl; } - public static final Pattern opaqueUri = Pattern.compile("^([^:/?#]+):([^/].*)"); - public static final Pattern hierarchicalUri = Pattern.compile("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"); + private static final Pattern opaqueUri = Pattern.compile("^([^:/?#]+):([^/].*)"); + private static final Pattern hierarchicalUri = Pattern.compile("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"); private static final Pattern hostPortPattern = Pattern.compile("([^/:]+):(\\d+)"); public static boolean compare(String s1, String s2) {