diff --git a/.github/scripts/sync-keycloak-sources.sh b/.github/scripts/sync-keycloak-sources.sh index 14b3b31..934a722 100755 --- a/.github/scripts/sync-keycloak-sources.sh +++ b/.github/scripts/sync-keycloak-sources.sh @@ -40,5 +40,6 @@ if [[ ! $PWD == *keycloak-client ]]; then error "The script is supposed to be executed in the root of 'keycloak-client' repository"; fi; +syncFiles client-common-synced syncFiles admin-client syncFiles authz-client diff --git a/README.md b/README.md index 773d0fe..a2e1fdb 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,16 @@ Keycloak-client java modules The files in the modules: +* [client-common-synced](client-common-synced) * [admin-client](admin-client) * [authz-client](authz-client) are not "owned" by this repository and hence the Java files should ideally not be directly updated. Those files are "owned" by the [main Keycloak server repository](https://github.com/keycloak/keycloak) and hence are supposed to be updated there (whenever needed) and synced into this repository by the bash script [sync-keycloak-sources.sh](.github/scripts/sync-keycloak-sources.sh) +> [!NOTE] +> **client-common-synced** module will be synced from Keycloak Main repository for the future and is a dependency of rest of the modules in this repository. Modules **admin-client** and **authz-client** may move to this repository in the future, therefore they are separated. + ## Syncing the files from Keycloak repository * Checkout [main Keycloak server repository](https://github.com/keycloak/keycloak) and build it on your laptop to make sure latest Keycloak stuff available in your local maven repository. diff --git a/admin-client/pom.xml b/admin-client/pom.xml index 2a90bdd..d3517e7 100755 --- a/admin-client/pom.xml +++ b/admin-client/pom.xml @@ -32,6 +32,10 @@ + + org.keycloak + keycloak-client-common-synced + com.fasterxml.jackson.core jackson-core @@ -99,73 +103,10 @@ sources true ${project.build.directory}/unpacked - **/* - META-INF/**/* - - - org.keycloak - keycloak-core - ${keycloak.version} - jar - sources - true - ${project.build.directory}/unpacked - - org/keycloak/OAuth2Constants.java, - org/keycloak/TokenCategory.java, - org/keycloak/Token.java, - org/keycloak/TokenIdGenerator.java, - org/keycloak/crypto/KeyUse.java, - org/keycloak/crypto/Algorithm.java, - org/keycloak/json/*.java, - org/keycloak/representations/adapters/action/GlobalRequestResult.java, - org/keycloak/representations/idm/**/*.java, - org/keycloak/representations/info/*.java, - org/keycloak/representations/userprofile/config/*.java, - org/keycloak/representations/AccessToken.java, - org/keycloak/representations/AccessTokenResponse.java, - org/keycloak/representations/AddressClaimSet.java, - org/keycloak/representations/IDToken.java, - org/keycloak/representations/JsonWebToken.java, - org/keycloak/representations/KeyStoreConfig.java, - org/keycloak/util/BasicAuthHelper.java, - org/keycloak/util/EnumWithStableIndex.java, - org/keycloak/util/JsonSerialization.java, - org/keycloak/util/SystemPropertiesJsonParserFactory.java, - - - - org.keycloak - keycloak-common - ${keycloak.version} - jar - sources - true - ${project.build.directory}/unpacked - - org/keycloak/common/util/Base64.java, - org/keycloak/common/util/CollectionUtil.java, - org/keycloak/common/util/MultivaluedHashMap.java, - org/keycloak/common/util/MultivaluedMap.java, - org/keycloak/common/util/ObjectUtil.java, - org/keycloak/common/util/StringPropertyReplacer.java, - org/keycloak/common/util/SystemEnvProperties.java, - org/keycloak/common/util/Time.java, - org/keycloak/common/crypto/CryptoConstants.java, - org/keycloak/common/constants/ServiceAccountConstants.java, - - - - org.keycloak - keycloak-server-spi - ${keycloak.version} - jar - sources - true - ${project.build.directory}/unpacked - org/keycloak/utils/StringUtil.java, - + org/**/*, + META-INF/services/* + false diff --git a/admin-client/src/main/java/org/keycloak/admin/client/resource/ClientTypesResource.java b/admin-client/src/main/java/org/keycloak/admin/client/resource/ClientTypesResource.java index 4138c58..f7f66e2 100644 --- a/admin-client/src/main/java/org/keycloak/admin/client/resource/ClientTypesResource.java +++ b/admin-client/src/main/java/org/keycloak/admin/client/resource/ClientTypesResource.java @@ -23,8 +23,6 @@ import jakarta.ws.rs.PUT; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; - -import org.jboss.resteasy.annotations.cache.NoCache; import org.keycloak.representations.idm.ClientTypesRepresentation; /** @@ -33,7 +31,6 @@ public interface ClientTypesResource { @GET - @NoCache @Produces(MediaType.APPLICATION_JSON) ClientTypesRepresentation getClientTypes(); diff --git a/authz-client/pom.xml b/authz-client/pom.xml index ac336f8..c38c107 100644 --- a/authz-client/pom.xml +++ b/authz-client/pom.xml @@ -17,12 +17,11 @@ Keycloak Authz: Client API KeyCloak AuthZ: Client API - - - 11 - - + + org.keycloak + keycloak-client-common-synced + org.jboss.logging jboss-logging @@ -100,93 +99,10 @@ sources true ${project.build.directory}/unpacked - **/* - META-INF/**/* - - - org.keycloak - keycloak-core - ${keycloak.version} - jar - sources - true - ${project.build.directory}/unpacked - - org/keycloak/OAuth2Constants.java, - org/keycloak/TokenCategory.java, - org/keycloak/Token.java, - org/keycloak/TokenIdGenerator.java, - org/keycloak/crypto/KeyUse.java, - org/keycloak/json/*.java, - org/keycloak/representations/adapters/action/GlobalRequestResult.java, - org/keycloak/representations/idm/**/*.java, - org/keycloak/representations/info/*.java, - org/keycloak/representations/userprofile/config/*.java, - org/keycloak/representations/AccessToken.java, - org/keycloak/representations/AccessTokenResponse.java, - org/keycloak/representations/AddressClaimSet.java, - org/keycloak/representations/IDToken.java, - org/keycloak/representations/JsonWebToken.java, - org/keycloak/representations/KeyStoreConfig.java, - org/keycloak/util/BasicAuthHelper.java, - org/keycloak/util/EnumWithStableIndex.java, - org/keycloak/util/JsonSerialization.java, - org/keycloak/util/SystemPropertiesJsonParserFactory.java, - - org/keycloak/jose/JOSE.java, - org/keycloak/jose/JOSEHeader.java, - org/keycloak/jose/jwe/**/*.java, - org/keycloak/jose/jws/**/*.java, - org/keycloak/jose/jwk/**/*.java, - org/keycloak/crypto/**/*.java, - - org/keycloak/representations/adapters/config/*.java, - org/keycloak/representations/RefreshToken.java, - org/keycloak/protocol/oidc/client/authentication/*.java, - org/keycloak/util/TokenUtil.java, - org/keycloak/AuthorizationContext.java, - org/keycloak/constants/ServiceUrlConstants.java, - - - - - org.keycloak - keycloak-core - ${keycloak.version} - jar - sources - true - ${project.build.directory}/unpacked-resources - - META-INF/services/**/* - - - - org.keycloak - keycloak-common - ${keycloak.version} - jar - sources - true - ${project.build.directory}/unpacked - org/keycloak/common/**/*.java, - - org/keycloak/common/util/Base64.java, - org/keycloak/common/util/CollectionUtil.java, - org/keycloak/common/util/MultivaluedHashMap.java, - org/keycloak/common/util/MultivaluedMap.java, - org/keycloak/common/util/ObjectUtil.java, - org/keycloak/common/util/StringPropertyReplacer.java, - org/keycloak/common/util/SystemEnvProperties.java, - org/keycloak/common/util/Time.java, - - org/keycloak/common/util/Encode.java, - org/keycloak/common/util/Base64Url.java, - org/keycloak/common/util/PemUtils.java, - org/keycloak/common/util/MimeTypeUtil.java, - - + org/**/*, + META-INF/services/* + false diff --git a/authz-client/src/main/java/org/keycloak/OAuth2Constants.java b/authz-client/src/main/java/org/keycloak/OAuth2Constants.java deleted file mode 100755 index b03dd25..0000000 --- a/authz-client/src/main/java/org/keycloak/OAuth2Constants.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak; - -/** - * @author Stian Thorgersen - */ -public interface OAuth2Constants { - - String CODE = "code"; - - String TOKEN = "token"; - - String CLIENT_ID = "client_id"; - - String CLIENT_SECRET = "client_secret"; - - String ERROR = "error"; - - String ERROR_DESCRIPTION = "error_description"; - - String REDIRECT_URI = "redirect_uri"; - - String POST_LOGOUT_REDIRECT_URI = "post_logout_redirect_uri"; - - String ID_TOKEN_HINT = "id_token_hint"; - - String DISPLAY = "display"; - - String SCOPE = "scope"; - - String STATE = "state"; - - String GRANT_TYPE = "grant_type"; - - String RESPONSE_TYPE = "response_type"; - - String ACCESS_TOKEN = "access_token"; - - String TOKEN_TYPE = "token_type"; - - String EXPIRES_IN = "expires_in"; - - String ID_TOKEN = "id_token"; - - String REFRESH_TOKEN = "refresh_token"; - - String LOGOUT_TOKEN = "logout_token"; - - String AUTHORIZATION_CODE = "authorization_code"; - - - String IMPLICIT = "implicit"; - - String USERNAME="username"; - - String PASSWORD = "password"; - - String CLIENT_CREDENTIALS = "client_credentials"; - - // https://tools.ietf.org/html/draft-ietf-oauth-assertions-01#page-5 - String CLIENT_ASSERTION_TYPE = "client_assertion_type"; - String CLIENT_ASSERTION = "client_assertion"; - - // https://tools.ietf.org/html/draft-jones-oauth-jwt-bearer-03#section-2.2 - String CLIENT_ASSERTION_TYPE_JWT = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"; - - // http://openid.net/specs/openid-connect-core-1_0.html#OfflineAccess - String OFFLINE_ACCESS = "offline_access"; - - // http://openid.net/specs/openid-connect-core-1_0.html#AuthRequest - String SCOPE_OPENID = "openid"; - - // http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims - String SCOPE_PROFILE = "profile"; - String SCOPE_EMAIL = "email"; - String SCOPE_ADDRESS = "address"; - String SCOPE_PHONE = "phone"; - - String ORGANIZATION = "organization"; - - String UI_LOCALES_PARAM = "ui_locales"; - - String PROMPT = "prompt"; - String ACR_VALUES = "acr_values"; - - String MAX_AGE = "max_age"; - - // OIDC Session Management - String SESSION_STATE = "session_state"; - - String JWT = "JWT"; - - // https://tools.ietf.org/html/rfc7636#section-6.1 - String CODE_VERIFIER = "code_verifier"; - String CODE_CHALLENGE = "code_challenge"; - String CODE_CHALLENGE_METHOD = "code_challenge_method"; - - // https://tools.ietf.org/html/rfc7636#section-6.2.2 - String PKCE_METHOD_PLAIN = "plain"; - String PKCE_METHOD_S256 = "S256"; - - // https://tools.ietf.org/html/rfc8693#section-2.1 - String TOKEN_EXCHANGE_GRANT_TYPE="urn:ietf:params:oauth:grant-type:token-exchange"; - String AUDIENCE="audience"; - String RESOURCE="resource"; - String REQUESTED_SUBJECT="requested_subject"; - String SUBJECT_TOKEN="subject_token"; - String SUBJECT_TOKEN_TYPE="subject_token_type"; - String ACTOR_TOKEN="actor_token"; - String ACTOR_TOKEN_TYPE="actor_token_type"; - String REQUESTED_TOKEN_TYPE="requested_token_type"; - String ISSUED_TOKEN_TYPE="issued_token_type"; - String REQUESTED_ISSUER="requested_issuer"; - String SUBJECT_ISSUER="subject_issuer"; - String ACCESS_TOKEN_TYPE="urn:ietf:params:oauth:token-type:access_token"; - String REFRESH_TOKEN_TYPE="urn:ietf:params:oauth:token-type:refresh_token"; - String JWT_TOKEN_TYPE="urn:ietf:params:oauth:token-type:jwt"; - String ID_TOKEN_TYPE="urn:ietf:params:oauth:token-type:id_token"; - String SAML2_TOKEN_TYPE = "urn:ietf:params:oauth:token-type:saml2"; - - String UMA_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:uma-ticket"; - - // https://tools.ietf.org/html/draft-ietf-oauth-device-flow-15#section-3.4 - String DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code"; - String DEVICE_CODE = "device_code"; - - String CIBA_GRANT_TYPE = "urn:openid:params:grant-type:ciba"; - - String INTERVAL = "interval"; - String USER_CODE = "user_code"; - - // https://openid.net/specs/openid-financial-api-jarm-ID1.html - String RESPONSE = "response"; - - // https://www.rfc-editor.org/rfc/rfc9207.html - String ISSUER = "iss"; - - String AUTHENTICATOR_METHOD_REFERENCE = "amr"; - - String CNF = "cnf"; -} - - diff --git a/authz-client/src/main/java/org/keycloak/Token.java b/authz-client/src/main/java/org/keycloak/Token.java deleted file mode 100644 index e856e2c..0000000 --- a/authz-client/src/main/java/org/keycloak/Token.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -public interface Token { - - @JsonIgnore - TokenCategory getCategory(); - -} diff --git a/authz-client/src/main/java/org/keycloak/TokenCategory.java b/authz-client/src/main/java/org/keycloak/TokenCategory.java deleted file mode 100644 index 45ab4b0..0000000 --- a/authz-client/src/main/java/org/keycloak/TokenCategory.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak; - -public enum TokenCategory { - INTERNAL, - ACCESS, - ID, - ADMIN, - USERINFO, - LOGOUT, - AUTHORIZATION_RESPONSE -} diff --git a/authz-client/src/main/java/org/keycloak/TokenIdGenerator.java b/authz-client/src/main/java/org/keycloak/TokenIdGenerator.java deleted file mode 100755 index fa08536..0000000 --- a/authz-client/src/main/java/org/keycloak/TokenIdGenerator.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak; - -import java.util.UUID; -import java.util.concurrent.atomic.AtomicLong; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class TokenIdGenerator { - private static final AtomicLong counter = new AtomicLong(); - - public static String generateId() { - return UUID.randomUUID().toString() + "-" + System.currentTimeMillis(); - } -} diff --git a/authz-client/src/main/java/org/keycloak/common/Version.java b/authz-client/src/main/java/org/keycloak/common/Version.java deleted file mode 100755 index 21280bb..0000000 --- a/authz-client/src/main/java/org/keycloak/common/Version.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.common; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class Version { - public static final String UNKNOWN = "UNKNOWN"; - public static final String NAME = "Keycloak"; - public static final String NAME_HTML = "
Keycloak
"; - public static String VERSION; - public static String RESOURCES_VERSION; - public static String BUILD_TIME; - - static { - try (InputStream is = Version.class.getResourceAsStream("/keycloak-version.properties")) { - Properties props = new Properties(); - props.load(is); - Version.VERSION = props.getProperty("version"); - Version.BUILD_TIME = props.getProperty("build-time"); - Version.RESOURCES_VERSION = Version.VERSION.toLowerCase(); - - if (Version.RESOURCES_VERSION.endsWith("-snapshot")) { - Version.RESOURCES_VERSION = Version.RESOURCES_VERSION.replace("-snapshot", "-" + Version.BUILD_TIME.replace(" ", "").replace(":", "").replace("-", "")); - } - } catch (IOException e) { - Version.VERSION = Version.UNKNOWN; - Version.BUILD_TIME = Version.UNKNOWN; - } - } - -} diff --git a/authz-client/src/main/java/org/keycloak/common/constants/ServiceAccountConstants.java b/authz-client/src/main/java/org/keycloak/common/constants/ServiceAccountConstants.java deleted file mode 100644 index 4dc0dd1..0000000 --- a/authz-client/src/main/java/org/keycloak/common/constants/ServiceAccountConstants.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.common.constants; - -/** - * @author Marek Posolda - */ -public interface ServiceAccountConstants { - - String CLIENT_AUTH = "client_auth"; - - String SERVICE_ACCOUNT_USER_PREFIX = "service-account-"; - - String CLIENT_ID_PROTOCOL_MAPPER = "Client ID"; - String CLIENT_HOST_PROTOCOL_MAPPER = "Client Host"; - String CLIENT_ADDRESS_PROTOCOL_MAPPER = "Client IP Address"; - - String CLIENT_ID_SESSION_NOTE = "clientId"; - String CLIENT_ID = "client_id"; - String CLIENT_HOST = "clientHost"; - String CLIENT_ADDRESS = "clientAddress"; - -} diff --git a/authz-client/src/main/java/org/keycloak/common/crypto/CryptoConstants.java b/authz-client/src/main/java/org/keycloak/common/crypto/CryptoConstants.java deleted file mode 100644 index 1c53e61..0000000 --- a/authz-client/src/main/java/org/keycloak/common/crypto/CryptoConstants.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.keycloak.common.crypto; - -/** - * @author Marek Posolda - */ -public class CryptoConstants { - - // JWE algorithms - public static final String A128KW = "A128KW"; - public static final String RSA1_5 = "RSA1_5"; - public static final String RSA_OAEP = "RSA-OAEP"; - public static final String RSA_OAEP_256 = "RSA-OAEP-256"; - public static final String ECDH_ES = "ECDH-ES"; - public static final String ECDH_ES_A128KW = "ECDH-ES+A128KW"; - public static final String ECDH_ES_A192KW = "ECDH-ES+A192KW"; - public static final String ECDH_ES_A256KW = "ECDH-ES+A256KW"; - - // Constant for the OCSP provider - // public static final String OCSP = "OCSP"; - - /** Name of Java security provider used with non-fips BouncyCastle. Should be used in non-FIPS environment */ - public static final String BC_PROVIDER_ID = "BC"; - - /** Name of Java security provider used with fips BouncyCastle. Should be used in FIPS environment */ - public static final String BCFIPS_PROVIDER_ID = "BCFIPS"; - -} diff --git a/authz-client/src/main/java/org/keycloak/common/util/Base64.java b/authz-client/src/main/java/org/keycloak/common/util/Base64.java deleted file mode 100644 index ddd7cc9..0000000 --- a/authz-client/src/main/java/org/keycloak/common/util/Base64.java +++ /dev/null @@ -1,1732 +0,0 @@ -package org.keycloak.common.util; - -import java.io.IOException; - -/** - *

Encodes and decodes to and from Base64 notation.

- *

Homepage: http://iharder.net/base64.

- * - *

Example:

- * - * String encoded = Base64.encode( myByteArray ); - *
- * byte[] myByteArray = Base64.decode( encoded ); - * - *

The options parameter, which appears in a few places, is used to pass - * several pieces of information to the encoder. In the "higher level" methods such as - * encodeBytes( bytes, options ) the options parameter can be used to indicate such - * things as first gzipping the bytes before encoding them, not inserting linefeeds, - * and encoding using the URL-safe and Ordered dialects.

- * - *

Note, according to RFC3548, - * Section 2.1, implementations should not add line feeds unless explicitly told - * to do so. I've got Base64 set to this behavior now, although earlier versions - * broke lines by default.

- * - *

The constants defined in Base64 can be OR-ed together to combine options, so you - * might make a call like this:

- * - * String encoded = Base64.encodeBytes( mybytes, Base64.GZIP | Base64.DO_BREAK_LINES ); - *

to compress the data before encoding it and then making the output have newline characters.

- *

Also...

- * String encoded = Base64.encodeBytes( crazyString.getBytes() ); - * - * - * - *

- * Change Log: - *

- *
    - *
  • v2.3.8 - Fixed automatic gzip decoding, based on the content, - * as this may lead to unexpected behaviour. Request either gzipped - * or non gzipped decoding as excepted. Automatic encoding is especially - * problematic with generated input (see KEYCLOAK-18914 for a detailed case).
  • - *
  • v2.3.7 - Fixed subtle bug when base 64 input stream contained the - * value 01111111, which is an invalid base 64 character but should not - * throw an ArrayIndexOutOfBoundsException either. Led to discovery of - * mishandling (or potential for better handling) of other bad input - * characters. You should now get an IOException if you try decoding - * something that has bad characters in it.
  • - *
  • v2.3.6 - Fixed bug when breaking lines and the final byte of the encoded - * string ended in the last column; the buffer was not properly shrunk and - * contained an extra (null) byte that made it into the string.
  • - *
  • v2.3.5 - Fixed bug in {@link #encodeFromFile} where estimated buffer size - * was wrong for files of size 31, 34, and 37 bytes.
  • - *
  • v2.3.4 - Fixed bug when working with gzipped streams whereby flushing - * the Base64.OutputStream closed the Base64 encoding (by padding with equals - * signs) too soon. Also added an option to suppress the automatic decoding - * of gzipped streams. Also added experimental support for specifying a - * class loader when using the - * {@link #decodeToObject(java.lang.String, int, java.lang.ClassLoader)} - * method.
  • - *
  • v2.3.3 - Changed default char encoding to US-ASCII which reduces the internal Java - * footprint with its CharEncoders and so forth. Fixed some javadocs that were - * inconsistent. Removed imports and specified things like java.io.IOException - * explicitly inline.
  • - *
  • v2.3.2 - Reduced memory footprint! Finally refined the "guessing" of how big the - * final encoded data will be so that the code doesn't have to create two output - * arrays: an oversized initial one and then a final, exact-sized one. Big win - * when using the {@link #encodeBytesToBytes(byte[])} family of methods (and not - * using the gzip options which uses a different mechanism with streams and stuff).
  • - *
  • v2.3.1 - Added {@link #encodeBytesToBytes(byte[], int, int, int)} and some - * similar helper methods to be more efficient with memory by not returning a - * String but just a byte array.
  • - *
  • v2.3 - This is not a drop-in replacement! This is two years of comments - * and bug fixes queued up and finally executed. Thanks to everyone who sent - * me stuff, and I'm sorry I wasn't able to distribute your fixes to everyone else. - * Much bad coding was cleaned up including throwing exceptions where necessary - * instead of returning null values or something similar. Here are some changes - * that may affect you: - *
      - *
    • Does not break lines, by default. This is to keep in compliance with - * RFC3548.
    • - *
    • Throws exceptions instead of returning null values. Because some operations - * (especially those that may permit the GZIP option) use IO streams, there - * is a possibility of an java.io.IOException being thrown. After some discussion and - * thought, I've changed the behavior of the methods to throw java.io.IOExceptions - * rather than return null if ever there's an error. I think this is more - * appropriate, though it will require some changes to your code. Sorry, - * it should have been done this way to begin with.
    • - *
    • Removed all references to System.out, System.err, and the like. - * Shame on me. All I can say is sorry they were ever there.
    • - *
    • Throws NullPointerExceptions and IllegalArgumentExceptions as needed - * such as when passed arrays are null or offsets are invalid.
    • - *
    • Cleaned up as much javadoc as I could to avoid any javadoc warnings. - * This was especially annoying before for people who were thorough in their - * own projects and then had gobs of javadoc warnings on this file.
    • - *
    - *
  • v2.2.1 - Fixed bug using URL_SAFE and ORDERED encodings. Fixed bug - * when using very small files (~< 40 bytes).
  • - *
  • v2.2 - Added some helper methods for encoding/decoding directly from - * one file to the next. Also added a main() method to support command line - * encoding/decoding from one file to the next. Also added these Base64 dialects: - *
      - *
    1. The default is RFC3548 format.
    2. - *
    3. Calling Base64.setFormat(Base64.BASE64_FORMAT.URLSAFE_FORMAT) generates - * URL and file name friendly format as described in Section 4 of RFC3548. - * http://www.faqs.org/rfcs/rfc3548.html
    4. - *
    5. Calling Base64.setFormat(Base64.BASE64_FORMAT.ORDERED_FORMAT) generates - * URL and file name friendly format that preserves lexical ordering as described - * in http://www.faqs.org/qa/rfcc-1940.html
    6. - *
    - * Special thanks to Jim Kellerman at http://www.powerset.com/ - * for contributing the new Base64 dialects. - *
  • - * - *
  • v2.1 - Cleaned up javadoc comments and unused variables and methods. Added - * some convenience methods for reading and writing to and from files.
  • - *
  • v2.0.2 - Now specifies UTF-8 encoding in places where the code fails on systems - * with other encodings (like EBCDIC).
  • - *
  • v2.0.1 - Fixed an error when decoding a single byte, that is, when the - * encoded data was a single byte.
  • - *
  • v2.0 - I got rid of methods that used booleans to set options. - * Now everything is more consolidated and cleaner. The code now detects - * when data that's being decoded is gzip-compressed and will decompress it - * automatically. Generally things are cleaner. You'll probably have to - * change some method calls that you were making to support the new - * options format (ints that you "OR" together).
  • - *
  • v1.5.1 - Fixed bug when decompressing and decoding to a - * byte[] using decode( String s, boolean gzipCompressed ). - * Added the ability to "suspend" encoding in the Output Stream so - * you can turn on and off the encoding if you need to embed base64 - * data in an otherwise "normal" stream (like an XML file).
  • - *
  • v1.5 - Output stream pases on flush() command but doesn't do anything itself. - * This helps when using GZIP streams. - * Added the ability to GZip-compress objects before encoding them.
  • - *
  • v1.4 - Added helper methods to read/write files.
  • - *
  • v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.
  • - *
  • v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream - * where last buffer being read, if not completely full, was not returned.
  • - *
  • v1.3.4 - Fixed when "improperly padded stream" error was thrown at the wrong time.
  • - *
  • v1.3.3 - Fixed I/O streams which were totally messed up.
  • - *
- * - *

- * I am placing this code in the Public Domain. Do with it as you will. - * This software comes with no guarantees or warranties but with - * plenty of well-wishing instead! - * Please visit http://iharder.net/base64 - * periodically to check for updates or to contribute improvements. - *

- * - * @author Robert Harder - * @author rob@iharder.net - * @version 2.3.7 - */ -public class Base64 -{ - -/* ******** P U B L I C F I E L D S ******** */ - - - /** No options specified. Value is zero. */ - public final static int NO_OPTIONS = 0; - - /** Specify encoding in first bit. Value is one. */ - public final static int ENCODE = 1; - - - /** Specify decoding in first bit. Value is zero. */ - public final static int DECODE = 0; - - - /** Specify that data should be gzip-compressed in second bit. Value is two. */ - public final static int GZIP = 2; - - /** Specify that data should be gunzipped. */ - public final static int GUNZIP = 4; - - /** Do break lines when encoding. Value is 8. */ - public final static int DO_BREAK_LINES = 8; - - /** - * Encode using Base64-like encoding that is URL- and Filename-safe as described - * in Section 4 of RFC3548: - * http://www.faqs.org/rfcs/rfc3548.html. - * It is important to note that data encoded this way is not officially valid Base64, - * or at the very least should not be called Base64 without also specifying that it - * was encoded using the URL- and Filename-safe dialect. - */ - public final static int URL_SAFE = 16; - - - /** - * Encode using the special "ordered" dialect of Base64 described here: - * http://www.faqs.org/qa/rfcc-1940.html. - */ - public final static int ORDERED = 32; - - -/* ******** P R I V A T E F I E L D S ******** */ - - - /** Maximum line length (76) of Base64 output. */ - private final static int MAX_LINE_LENGTH = 76; - - - /** The equals sign (=) as a byte. */ - private final static byte EQUALS_SIGN = (byte)'='; - - - /** The new line character (\n) as a byte. */ - private final static byte NEW_LINE = (byte)'\n'; - - - /** Preferred encoding. */ - private final static String PREFERRED_ENCODING = "US-ASCII"; - - - private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding - private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding - - -/* ******** S T A N D A R D B A S E 6 4 A L P H A B E T ******** */ - - /** The 64 valid Base64 values. */ - /* Host platform me be something funny like EBCDIC, so we hardcode these values. */ - private final static byte[] _STANDARD_ALPHABET = { - (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', - (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', - (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', - (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z', - (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g', - (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n', - (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u', - (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z', - (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', - (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/' - }; - - - /** - * Translates a Base64 value to either its 6-bit reconstruction value - * or a negative number indicating some other meaning. - **/ - private final static byte[] _STANDARD_DECODABET = { - -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8 - -5,-5, // Whitespace: Tab and Linefeed - -9,-9, // Decimal 11 - 12 - -5, // Whitespace: Carriage Return - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26 - -9,-9,-9,-9,-9, // Decimal 27 - 31 - -5, // Whitespace: Space - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42 - 62, // Plus sign at decimal 43 - -9,-9,-9, // Decimal 44 - 46 - 63, // Slash at decimal 47 - 52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine - -9,-9,-9, // Decimal 58 - 60 - -1, // Equals sign at decimal 61 - -9,-9,-9, // Decimal 62 - 64 - 0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N' - 14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z' - -9,-9,-9,-9,-9,-9, // Decimal 91 - 96 - 26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm' - 39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z' - -9,-9,-9,-9,-9 // Decimal 123 - 127 - ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 128 - 139 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 - }; - - -/* ******** U R L S A F E B A S E 6 4 A L P H A B E T ******** */ - - /** - * Used in the URL- and Filename-safe dialect described in Section 4 of RFC3548: - * http://www.faqs.org/rfcs/rfc3548.html. - * Notice that the last two bytes become "hyphen" and "underscore" instead of "plus" and "slash." - */ - private final static byte[] _URL_SAFE_ALPHABET = { - (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', - (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', - (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', - (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z', - (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g', - (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n', - (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u', - (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z', - (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', - (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'-', (byte)'_' - }; - - /** - * Used in decoding URL- and Filename-safe dialects of Base64. - */ - private final static byte[] _URL_SAFE_DECODABET = { - -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8 - -5,-5, // Whitespace: Tab and Linefeed - -9,-9, // Decimal 11 - 12 - -5, // Whitespace: Carriage Return - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26 - -9,-9,-9,-9,-9, // Decimal 27 - 31 - -5, // Whitespace: Space - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42 - -9, // Plus sign at decimal 43 - -9, // Decimal 44 - 62, // Minus sign at decimal 45 - -9, // Decimal 46 - -9, // Slash at decimal 47 - 52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine - -9,-9,-9, // Decimal 58 - 60 - -1, // Equals sign at decimal 61 - -9,-9,-9, // Decimal 62 - 64 - 0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N' - 14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z' - -9,-9,-9,-9, // Decimal 91 - 94 - 63, // Underscore at decimal 95 - -9, // Decimal 96 - 26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm' - 39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z' - -9,-9,-9,-9,-9 // Decimal 123 - 127 - ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 128 - 139 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 - }; - - - -/* ******** O R D E R E D B A S E 6 4 A L P H A B E T ******** */ - - /** - * I don't get the point of this technique, but someone requested it, - * and it is described here: - * http://www.faqs.org/qa/rfcc-1940.html. - */ - private final static byte[] _ORDERED_ALPHABET = { - (byte)'-', - (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', - (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9', - (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', - (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', - (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', - (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z', - (byte)'_', - (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g', - (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n', - (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u', - (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z' - }; - - /** - * Used in decoding the "ordered" dialect of Base64. - */ - private final static byte[] _ORDERED_DECODABET = { - -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8 - -5,-5, // Whitespace: Tab and Linefeed - -9,-9, // Decimal 11 - 12 - -5, // Whitespace: Carriage Return - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26 - -9,-9,-9,-9,-9, // Decimal 27 - 31 - -5, // Whitespace: Space - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42 - -9, // Plus sign at decimal 43 - -9, // Decimal 44 - 0, // Minus sign at decimal 45 - -9, // Decimal 46 - -9, // Slash at decimal 47 - 1,2,3,4,5,6,7,8,9,10, // Numbers zero through nine - -9,-9,-9, // Decimal 58 - 60 - -1, // Equals sign at decimal 61 - -9,-9,-9, // Decimal 62 - 64 - 11,12,13,14,15,16,17,18,19,20,21,22,23, // Letters 'A' through 'M' - 24,25,26,27,28,29,30,31,32,33,34,35,36, // Letters 'N' through 'Z' - -9,-9,-9,-9, // Decimal 91 - 94 - 37, // Underscore at decimal 95 - -9, // Decimal 96 - 38,39,40,41,42,43,44,45,46,47,48,49,50, // Letters 'a' through 'm' - 51,52,53,54,55,56,57,58,59,60,61,62,63, // Letters 'n' through 'z' - -9,-9,-9,-9,-9 // Decimal 123 - 127 - ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 128 - 139 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243 - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 - }; - - -/* ******** D E T E R M I N E W H I C H A L H A B E T ******** */ - - - /** - * Returns one of the _SOMETHING_ALPHABET byte arrays depending on - * the options specified. - * It's possible, though silly, to specify ORDERED and URLSAFE - * in which case one of them will be picked, though there is - * no guarantee as to which one will be picked. - */ - private final static byte[] getAlphabet( int options ) { - if ((options & URL_SAFE) == URL_SAFE) { - return _URL_SAFE_ALPHABET; - } else if ((options & ORDERED) == ORDERED) { - return _ORDERED_ALPHABET; - } else { - return _STANDARD_ALPHABET; - } - } // end getAlphabet - - - /** - * Returns one of the _SOMETHING_DECODABET byte arrays depending on - * the options specified. - * It's possible, though silly, to specify ORDERED and URL_SAFE - * in which case one of them will be picked, though there is - * no guarantee as to which one will be picked. - */ - private final static byte[] getDecodabet( int options ) { - if( (options & URL_SAFE) == URL_SAFE) { - return _URL_SAFE_DECODABET; - } else if ((options & ORDERED) == ORDERED) { - return _ORDERED_DECODABET; - } else { - return _STANDARD_DECODABET; - } - } // end getAlphabet - - - - /** Defeats instantiation. */ - private Base64(){} - - - - -/* ******** E N C O D I N G M E T H O D S ******** */ - - - /** - * Encodes up to the first three bytes of array threeBytes - * and returns a four-byte array in Base64 notation. - * The actual number of significant bytes in your array is - * given by numSigBytes. - * The array threeBytes needs only be as big as - * numSigBytes. - * Code can reuse a byte array by passing a four-byte array as b4. - * - * @param b4 A reusable byte array to reduce array instantiation - * @param threeBytes the array to convert - * @param numSigBytes the number of significant bytes in your array - * @return four byte array in Base64 notation. - * @since 1.5.1 - */ - private static byte[] encode3to4( byte[] b4, byte[] threeBytes, int numSigBytes, int options ) { - encode3to4( threeBytes, 0, numSigBytes, b4, 0, options ); - return b4; - } // end encode3to4 - - - /** - *

Encodes up to three bytes of the array source - * and writes the resulting four Base64 bytes to destination. - * The source and destination arrays can be manipulated - * anywhere along their length by specifying - * srcOffset and destOffset. - * This method does not check to make sure your arrays - * are large enough to accommodate srcOffset + 3 for - * the source array or destOffset + 4 for - * the destination array. - * The actual number of significant bytes in your array is - * given by numSigBytes.

- *

This is the lowest level of the encoding methods with - * all possible parameters.

- * - * @param source the array to convert - * @param srcOffset the index where conversion begins - * @param numSigBytes the number of significant bytes in your array - * @param destination the array to hold the conversion - * @param destOffset the index where output will be put - * @return the destination array - * @since 1.3 - */ - private static byte[] encode3to4( - byte[] source, int srcOffset, int numSigBytes, - byte[] destination, int destOffset, int options ) { - - byte[] ALPHABET = getAlphabet( options ); - - // 1 2 3 - // 01234567890123456789012345678901 Bit position - // --------000000001111111122222222 Array position from threeBytes - // --------| || || || | Six bit groups to index ALPHABET - // >>18 >>12 >> 6 >> 0 Right shift necessary - // 0x3f 0x3f 0x3f Additional AND - - // Create buffer with zero-padding if there are only one or two - // significant bytes passed in the array. - // We have to shift left 24 in order to flush out the 1's that appear - // when Java treats a value as negative that is cast from a byte to an int. - int inBuff = ( numSigBytes > 0 ? ((source[ srcOffset ] << 24) >>> 8) : 0 ) - | ( numSigBytes > 1 ? ((source[ srcOffset + 1 ] << 24) >>> 16) : 0 ) - | ( numSigBytes > 2 ? ((source[ srcOffset + 2 ] << 24) >>> 24) : 0 ); - - switch( numSigBytes ) - { - case 3: - destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ]; - destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ]; - destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ]; - destination[ destOffset + 3 ] = ALPHABET[ (inBuff ) & 0x3f ]; - return destination; - - case 2: - destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ]; - destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ]; - destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ]; - destination[ destOffset + 3 ] = EQUALS_SIGN; - return destination; - - case 1: - destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ]; - destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ]; - destination[ destOffset + 2 ] = EQUALS_SIGN; - destination[ destOffset + 3 ] = EQUALS_SIGN; - return destination; - - default: - return destination; - } // end switch - } // end encode3to4 - - - - /** - * Performs Base64 encoding on the raw ByteBuffer, - * writing it to the encoded ByteBuffer. - * This is an experimental feature. Currently it does not - * pass along any options (such as {@link #DO_BREAK_LINES} - * or {@link #GZIP}). - * - * @param raw input buffer - * @param encoded output buffer - * @since 2.3 - */ - public static void encode( java.nio.ByteBuffer raw, java.nio.ByteBuffer encoded ){ - byte[] raw3 = new byte[3]; - byte[] enc4 = new byte[4]; - - while( raw.hasRemaining() ){ - int rem = Math.min(3,raw.remaining()); - raw.get(raw3,0,rem); - Base64.encode3to4(enc4, raw3, rem, Base64.NO_OPTIONS); - encoded.put(enc4); - } // end input remaining - } - - - /** - * Performs Base64 encoding on the raw ByteBuffer, - * writing it to the encoded CharBuffer. - * This is an experimental feature. Currently it does not - * pass along any options (such as {@link #DO_BREAK_LINES} - * or {@link #GZIP}. - * - * @param raw input buffer - * @param encoded output buffer - * @since 2.3 - */ - public static void encode( java.nio.ByteBuffer raw, java.nio.CharBuffer encoded ){ - byte[] raw3 = new byte[3]; - byte[] enc4 = new byte[4]; - - while( raw.hasRemaining() ){ - int rem = Math.min(3,raw.remaining()); - raw.get(raw3,0,rem); - Base64.encode3to4(enc4, raw3, rem, Base64.NO_OPTIONS ); - for( int i = 0; i < 4; i++ ){ - encoded.put( (char)(enc4[i] & 0xFF) ); - } - } // end input remaining - } - - - - - /** - * Serializes an object and returns the Base64-encoded - * version of that serialized object. - * - *

As of v 2.3, if the object - * cannot be serialized or there is another error, - * the method will throw an java.io.IOException. This is new to v2.3! - * In earlier versions, it just returned a null value, but - * in retrospect that's a pretty poor way to handle it.

- * - * The object is not GZip-compressed before being encoded. - * - * @param serializableObject The object to encode - * @return The Base64-encoded object - * @throws java.io.IOException if there is an error - * @throws NullPointerException if serializedObject is null - * @since 1.4 - */ - public static String encodeObject( java.io.Serializable serializableObject ) - throws java.io.IOException { - return encodeObject( serializableObject, NO_OPTIONS ); - } // end encodeObject - - - - /** - * Serializes an object and returns the Base64-encoded - * version of that serialized object. - * - *

As of v 2.3, if the object - * cannot be serialized or there is another error, - * the method will throw an java.io.IOException. This is new to v2.3! - * In earlier versions, it just returned a null value, but - * in retrospect that's a pretty poor way to handle it.

- * - * The object is not GZip-compressed before being encoded. - *

- * Example options:

-     *   GZIP: gzip-compresses object before encoding it.
-     *   DO_BREAK_LINES: break lines at 76 characters
-     * 
- *

- * Example: encodeObject( myObj, Base64.GZIP ) or - *

- * Example: encodeObject( myObj, Base64.GZIP | Base64.DO_BREAK_LINES ) - * - * @param serializableObject The object to encode - * @param options Specified options - * @return The Base64-encoded object - * @see Base64#GZIP - * @see Base64#DO_BREAK_LINES - * @throws java.io.IOException if there is an error - * @since 2.0 - */ - public static String encodeObject( java.io.Serializable serializableObject, int options ) - throws java.io.IOException { - - if( serializableObject == null ){ - throw new NullPointerException( "Cannot serialize a null object." ); - } // end if: null - - // Streams - java.io.ByteArrayOutputStream baos = null; - java.io.OutputStream b64os = null; - java.util.zip.GZIPOutputStream gzos = null; - java.io.ObjectOutputStream oos = null; - - - try { - // ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream - baos = new java.io.ByteArrayOutputStream(); - b64os = new Base64.OutputStream( baos, ENCODE | options ); - if( (options & GZIP) != 0 ){ - // Gzip - gzos = new java.util.zip.GZIPOutputStream(b64os); - oos = new java.io.ObjectOutputStream( gzos ); - } else { - // Not gzipped - oos = new java.io.ObjectOutputStream( b64os ); - } - oos.writeObject( serializableObject ); - } // end try - catch( java.io.IOException e ) { - // Catch it and then throw it immediately so that - // the finally{} block is called for cleanup. - throw e; - } // end catch - finally { - try{ oos.close(); } catch( Exception e ){} - try{ gzos.close(); } catch( Exception e ){} - try{ b64os.close(); } catch( Exception e ){} - try{ baos.close(); } catch( Exception e ){} - } // end finally - - // Return value according to relevant encoding. - try { - return new String( baos.toByteArray(), PREFERRED_ENCODING ); - } // end try - catch (java.io.UnsupportedEncodingException uue){ - // Fall back to some Java default - return new String( baos.toByteArray() ); - } // end catch - - } // end encode - - - - /** - * Encodes a byte array into Base64 notation. - * Does not GZip-compress data. - * - * @param source The data to convert - * @return The data in Base64-encoded form - * @throws NullPointerException if source array is null - * @since 1.4 - */ - public static String encodeBytes( byte[] source ) { - // Since we're not going to have the GZIP encoding turned on, - // we're not going to have an java.io.IOException thrown, so - // we should not force the user to have to catch it. - String encoded = null; - try { - encoded = encodeBytes(source, 0, source.length, NO_OPTIONS); - } catch (java.io.IOException ex) { - assert false : ex.getMessage(); - } // end catch - assert encoded != null; - return encoded; - } // end encodeBytes - - - - /** - * Encodes a byte array into Base64 notation. - *

- * Example options:

-     *   GZIP: gzip-compresses object before encoding it.
-     *   DO_BREAK_LINES: break lines at 76 characters
-     *     Note: Technically, without line break your encoding may become non-compliant (see rfc2045 and rfc4648).
-     * 
- *

- * Example: encodeBytes( myData, Base64.GZIP ) or - *

- * Example: encodeBytes( myData, Base64.GZIP | Base64.DO_BREAK_LINES ) - * - * - *

As of v 2.3, if there is an error with the GZIP stream, - * the method will throw an java.io.IOException. This is new to v2.3! - * In earlier versions, it just returned a null value, but - * in retrospect that's a pretty poor way to handle it.

- * - * - * @param source The data to convert - * @param options Specified options - * @return The Base64-encoded data as a String - * @see Base64#GZIP - * @see Base64#DO_BREAK_LINES - * @throws java.io.IOException if there is an error - * @throws NullPointerException if source array is null - * @since 2.0 - */ - public static String encodeBytes( byte[] source, int options ) throws java.io.IOException { - return encodeBytes( source, 0, source.length, options ); - } // end encodeBytes - - - /** - * Encodes a byte array into Base64 notation. - * Does not GZip-compress data. - * - *

As of v 2.3, if there is an error, - * the method will throw an java.io.IOException. This is new to v2.3! - * In earlier versions, it just returned a null value, but - * in retrospect that's a pretty poor way to handle it.

- * - * - * @param source The data to convert - * @param off Offset in array where conversion should begin - * @param len Length of data to convert - * @return The Base64-encoded data as a String - * @throws NullPointerException if source array is null - * @throws IllegalArgumentException if source array, offset, or length are invalid - * @since 1.4 - */ - public static String encodeBytes( byte[] source, int off, int len ) { - // Since we're not going to have the GZIP encoding turned on, - // we're not going to have an java.io.IOException thrown, so - // we should not force the user to have to catch it. - String encoded = null; - try { - encoded = encodeBytes( source, off, len, NO_OPTIONS ); - } catch (java.io.IOException ex) { - assert false : ex.getMessage(); - } // end catch - assert encoded != null; - return encoded; - } // end encodeBytes - - - - /** - * Encodes a byte array into Base64 notation. - *

- * Example options:

-     *   GZIP: gzip-compresses object before encoding it.
-     *   DO_BREAK_LINES: break lines at 76 characters
-     *     Note: Technically, this makes your encoding non-compliant.
-     * 
- *

- * Example: encodeBytes( myData, Base64.GZIP ) or - *

- * Example: encodeBytes( myData, Base64.GZIP | Base64.DO_BREAK_LINES ) - * - * - *

As of v 2.3, if there is an error with the GZIP stream, - * the method will throw an java.io.IOException. This is new to v2.3! - * In earlier versions, it just returned a null value, but - * in retrospect that's a pretty poor way to handle it.

- * - * - * @param source The data to convert - * @param off Offset in array where conversion should begin - * @param len Length of data to convert - * @param options Specified options - * @return The Base64-encoded data as a String - * @see Base64#GZIP - * @see Base64#DO_BREAK_LINES - * @throws java.io.IOException if there is an error - * @throws NullPointerException if source array is null - * @throws IllegalArgumentException if source array, offset, or length are invalid - * @since 2.0 - */ - public static String encodeBytes( byte[] source, int off, int len, int options ) throws java.io.IOException { - byte[] encoded = encodeBytesToBytes( source, off, len, options ); - - // Return value according to relevant encoding. - try { - return new String( encoded, PREFERRED_ENCODING ); - } // end try - catch (java.io.UnsupportedEncodingException uue) { - return new String( encoded ); - } // end catch - - } // end encodeBytes - - - - - /** - * Similar to {@link #encodeBytes(byte[])} but returns - * a byte array instead of instantiating a String. This is more efficient - * if you're working with I/O streams and have large data sets to encode. - * - * - * @param source The data to convert - * @return The Base64-encoded data as a byte[] (of ASCII characters) - * @throws NullPointerException if source array is null - * @since 2.3.1 - */ - public static byte[] encodeBytesToBytes( byte[] source ) { - byte[] encoded = null; - try { - encoded = encodeBytesToBytes( source, 0, source.length, Base64.NO_OPTIONS ); - } catch( java.io.IOException ex ) { - assert false : "IOExceptions only come from GZipping, which is turned off: " + ex.getMessage(); - } - return encoded; - } - - - /** - * Similar to {@link #encodeBytes(byte[], int, int, int)} but returns - * a byte array instead of instantiating a String. This is more efficient - * if you're working with I/O streams and have large data sets to encode. - * - * - * @param source The data to convert - * @param off Offset in array where conversion should begin - * @param len Length of data to convert - * @param options Specified options - * @return The Base64-encoded data as a String - * @see Base64#GZIP - * @see Base64#DO_BREAK_LINES - * @throws java.io.IOException if there is an error - * @throws NullPointerException if source array is null - * @throws IllegalArgumentException if source array, offset, or length are invalid - * @since 2.3.1 - */ - public static byte[] encodeBytesToBytes( byte[] source, int off, int len, int options ) throws java.io.IOException { - - if( source == null ){ - throw new NullPointerException( "Cannot serialize a null array." ); - } // end if: null - - if( off < 0 ){ - throw new IllegalArgumentException( "Cannot have negative offset: " + off ); - } // end if: off < 0 - - if( len < 0 ){ - throw new IllegalArgumentException( "Cannot have length offset: " + len ); - } // end if: len < 0 - - if( off + len > source.length ){ - throw new IllegalArgumentException( - String.format( "Cannot have offset of %d and length of %d with array of length %d", off,len,source.length)); - } // end if: off < 0 - - - - // Compress? - if( (options & GZIP) != 0 ) { - java.io.ByteArrayOutputStream baos = null; - java.util.zip.GZIPOutputStream gzos = null; - Base64.OutputStream b64os = null; - - try { - // GZip -> Base64 -> ByteArray - baos = new java.io.ByteArrayOutputStream(); - b64os = new Base64.OutputStream( baos, ENCODE | options ); - gzos = new java.util.zip.GZIPOutputStream( b64os ); - - gzos.write( source, off, len ); - gzos.close(); - } // end try - catch( java.io.IOException e ) { - // Catch it and then throw it immediately so that - // the finally{} block is called for cleanup. - throw e; - } // end catch - finally { - try{ gzos.close(); } catch( Exception e ){} - try{ b64os.close(); } catch( Exception e ){} - try{ baos.close(); } catch( Exception e ){} - } // end finally - - return baos.toByteArray(); - } // end if: compress - - // Else, don't compress. Better not to use streams at all then. - else { - boolean breakLines = (options & DO_BREAK_LINES) != 0; - - //int len43 = len * 4 / 3; - //byte[] outBuff = new byte[ ( len43 ) // Main 4:3 - // + ( (len % 3) > 0 ? 4 : 0 ) // Account for padding - // + (breakLines ? ( len43 / MAX_LINE_LENGTH ) : 0) ]; // New lines - // Try to determine more precisely how big the array needs to be. - // If we get it right, we don't have to do an array copy, and - // we save a bunch of memory. - int encLen = ( len / 3 ) * 4 + ( len % 3 > 0 ? 4 : 0 ); // Bytes needed for actual encoding - if( breakLines ){ - encLen += encLen / MAX_LINE_LENGTH; // Plus extra newline characters - } - byte[] outBuff = new byte[ encLen ]; - - - int d = 0; - int e = 0; - int len2 = len - 2; - int lineLength = 0; - for( ; d < len2; d+=3, e+=4 ) { - encode3to4( source, d+off, 3, outBuff, e, options ); - - lineLength += 4; - if( breakLines && lineLength >= MAX_LINE_LENGTH ) - { - outBuff[e+4] = NEW_LINE; - e++; - lineLength = 0; - } // end if: end of line - } // en dfor: each piece of array - - if( d < len ) { - encode3to4( source, d+off, len - d, outBuff, e, options ); - e += 4; - } // end if: some padding needed - - - // Only resize array if we didn't guess it right. - if( e <= outBuff.length - 1 ){ - // If breaking lines and the last byte falls right at - // the line length (76 bytes per line), there will be - // one extra byte, and the array will need to be resized. - // Not too bad of an estimate on array size, I'd say. - byte[] finalOut = new byte[e]; - System.arraycopy(outBuff,0, finalOut,0,e); - //System.err.println("Having to resize array from " + outBuff.length + " to " + e ); - return finalOut; - } else { - //System.err.println("No need to resize array."); - return outBuff; - } - - } // end else: don't compress - - } // end encodeBytesToBytes - - - - - -/* ******** D E C O D I N G M E T H O D S ******** */ - - - /** - * Decodes four bytes from array source - * and writes the resulting bytes (up to three of them) - * to destination. - * The source and destination arrays can be manipulated - * anywhere along their length by specifying - * srcOffset and destOffset. - * This method does not check to make sure your arrays - * are large enough to accommodate srcOffset + 4 for - * the source array or destOffset + 3 for - * the destination array. - * This method returns the actual number of bytes that - * were converted from the Base64 encoding. - *

This is the lowest level of the decoding methods with - * all possible parameters.

- * - * - * @param source the array to convert - * @param srcOffset the index where conversion begins - * @param destination the array to hold the conversion - * @param destOffset the index where output will be put - * @param options alphabet type is pulled from this (standard, url-safe, ordered) - * @return the number of decoded bytes converted - * @throws NullPointerException if source or destination arrays are null - * @throws IllegalArgumentException if srcOffset or destOffset are invalid - * or there is not enough room in the array. - * @since 1.3 - */ - private static int decode4to3( - byte[] source, int srcOffset, - byte[] destination, int destOffset, int options ) { - - // Lots of error checking and exception throwing - if( source == null ){ - throw new NullPointerException( "Source array was null." ); - } // end if - if( destination == null ){ - throw new NullPointerException( "Destination array was null." ); - } // end if - if( srcOffset < 0 || srcOffset + 3 >= source.length ){ - throw new IllegalArgumentException( String.format( - "Source array with length %d cannot have offset of %d and still process four bytes.", source.length, srcOffset ) ); - } // end if - if( destOffset < 0 || destOffset +2 >= destination.length ){ - throw new IllegalArgumentException( String.format( - "Destination array with length %d cannot have offset of %d and still store three bytes.", destination.length, destOffset ) ); - } // end if - - - byte[] DECODABET = getDecodabet( options ); - - // Example: Dk== - if( source[ srcOffset + 2] == EQUALS_SIGN ) { - // Two ways to do the same thing. Don't know which way I like best. - //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 ) - // | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 ); - int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 ) - | ( ( DECODABET[ source[ srcOffset + 1] ] & 0xFF ) << 12 ); - - destination[ destOffset ] = (byte)( outBuff >>> 16 ); - return 1; - } - - // Example: DkL= - else if( source[ srcOffset + 3 ] == EQUALS_SIGN ) { - // Two ways to do the same thing. Don't know which way I like best. - //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 ) - // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 ) - // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 ); - int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 ) - | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 ) - | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6 ); - - destination[ destOffset ] = (byte)( outBuff >>> 16 ); - destination[ destOffset + 1 ] = (byte)( outBuff >>> 8 ); - return 2; - } - - // Example: DkLE - else { - // Two ways to do the same thing. Don't know which way I like best. - //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 ) - // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 ) - // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 ) - // | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 ); - int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 ) - | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 ) - | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6) - | ( ( DECODABET[ source[ srcOffset + 3 ] ] & 0xFF ) ); - - - destination[ destOffset ] = (byte)( outBuff >> 16 ); - destination[ destOffset + 1 ] = (byte)( outBuff >> 8 ); - destination[ destOffset + 2 ] = (byte)( outBuff ); - - return 3; - } - } // end decodeToBytes - - - - - - /** - * Low-level access to decoding ASCII characters in - * the form of a byte array. Ignores GUNZIP option, if - * it's set. This is not generally a recommended method, - * although it is used internally as part of the decoding process. - * Special case: if len = 0, an empty array is returned. Still, - * if you need more speed and reduced memory footprint (and aren't - * gzipping), consider this method. - * - * @param source The Base64 encoded data - * @return decoded data - * @since 2.3.1 - */ - public static byte[] decode( byte[] source ) throws java.io.IOException { - return decode( source, 0, source.length, Base64.NO_OPTIONS ); - } - - - - /** - * Low-level access to decoding ASCII characters in - * the form of a byte array. Ignores GUNZIP option, if - * it's set. This is not generally a recommended method, - * although it is used internally as part of the decoding process. - * Special case: if len = 0, an empty array is returned. Still, - * if you need more speed and reduced memory footprint (and aren't - * gzipping), consider this method. - * - * @param source The Base64 encoded data - * @param off The offset of where to begin decoding - * @param len The length of characters to decode - * @param options Can specify options such as alphabet type to use - * @return decoded data - * @throws java.io.IOException If bogus characters exist in source data - * @since 1.3 - */ - public static byte[] decode( byte[] source, int off, int len, int options ) - throws java.io.IOException { - - // Lots of error checking and exception throwing - if( source == null ){ - throw new NullPointerException( "Cannot decode null source array." ); - } // end if - if( off < 0 || off + len > source.length ){ - throw new IllegalArgumentException( String.format( - "Source array with length %d cannot have offset of %d and process %d bytes.", source.length, off, len ) ); - } // end if - - if( len == 0 ){ - return new byte[0]; - }else if( len < 4 ){ - throw new IllegalArgumentException( - "Base64-encoded string must have at least four characters, but length specified was " + len ); - } // end if - - byte[] DECODABET = getDecodabet( options ); - - int len34 = len * 3 / 4; // Estimate on array size - byte[] outBuff = new byte[ len34 ]; // Upper limit on size of output - int outBuffPosn = 0; // Keep track of where we're writing - - byte[] b4 = new byte[4]; // Four byte buffer from source, eliminating white space - int b4Posn = 0; // Keep track of four byte input buffer - int i = 0; // Source array counter - byte sbiDecode = 0; // Special value from DECODABET - - for( i = off; i < off+len; i++ ) { // Loop through source - - sbiDecode = DECODABET[ source[i]&0xFF ]; - - // White space, Equals sign, or legit Base64 character - // Note the values such as -5 and -9 in the - // DECODABETs at the top of the file. - if( sbiDecode >= WHITE_SPACE_ENC ) { - if( sbiDecode >= EQUALS_SIGN_ENC ) { - b4[ b4Posn++ ] = source[i]; // Save non-whitespace - if( b4Posn > 3 ) { // Time to decode? - outBuffPosn += decode4to3( b4, 0, outBuff, outBuffPosn, options ); - b4Posn = 0; - - // If that was the equals sign, break out of 'for' loop - if( source[i] == EQUALS_SIGN ) { - break; - } // end if: equals sign - } // end if: quartet built - } // end if: equals sign or better - } // end if: white space, equals sign or better - else { - // There's a bad input character in the Base64 stream. - throw new java.io.IOException( String.format( - "Bad Base64 input character decimal %d in array position %d", ((int)source[i])&0xFF, i ) ); - } // end else: - } // each input character - - byte[] out = new byte[ outBuffPosn ]; - System.arraycopy( outBuff, 0, out, 0, outBuffPosn ); - return out; - } // end decode - - - - - /** - * Decodes data from Base64 notation, automatically - * detecting gzip-compressed data and decompressing it. - * - * @param s the string to decode - * @return the decoded data - * @throws java.io.IOException If there is a problem - * @since 1.4 - */ - public static byte[] decode( String s ) throws java.io.IOException { - return decode( s, NO_OPTIONS ); - } - - - - /** - * Decodes data from Base64 notation, automatically - * detecting gzip-compressed data and decompressing it. - * - * @param s the string to decode - * @param options decode options such as URL_SAFE or GUNZIP - * @return the decoded data - * @throws java.io.IOException if there is an error (invalid character in source string or gunzip error) - * @throws NullPointerException if s is null - * @since 1.4 - */ - public static byte[] decode( String s, int options ) throws java.io.IOException { - - if( s == null ){ - throw new NullPointerException( "Input string was null." ); - } // end if - - byte[] bytes; - try { - bytes = s.getBytes( PREFERRED_ENCODING ); - } // end try - catch( java.io.UnsupportedEncodingException uee ) { - bytes = s.getBytes(); - } // end catch - // - - // Decode - bytes = decode( bytes, 0, bytes.length, options ); - - // Check to see if it's gzip-compressed - // GZIP Magic Two-Byte Number: 0x8b1f (35615) - boolean doGunzip = (options & GUNZIP) != 0; - if( (bytes != null) && (bytes.length >= 4) && doGunzip ) { - - int head = ((int)bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00); - if( java.util.zip.GZIPInputStream.GZIP_MAGIC != head ) { - throw new IOException("Provided data has no GZIP magic header."); - } - java.io.ByteArrayInputStream bais = null; - java.util.zip.GZIPInputStream gzis = null; - java.io.ByteArrayOutputStream baos = null; - byte[] buffer = new byte[2048]; - int length = 0; - - try { - baos = new java.io.ByteArrayOutputStream(); - bais = new java.io.ByteArrayInputStream( bytes ); - gzis = new java.util.zip.GZIPInputStream( bais ); - - while( ( length = gzis.read( buffer ) ) >= 0 ) { - baos.write(buffer,0,length); - } // end while: reading input - - // No error? Get new bytes. - bytes = baos.toByteArray(); - - } // end try - catch( java.io.IOException e ) { - throw new IOException("Failed to gunzip", e); - } // end catch - finally { - try{ baos.close(); } catch( Exception e ){} - try{ gzis.close(); } catch( Exception e ){} - try{ bais.close(); } catch( Exception e ){} - } // end finally - - } // end if: bytes.length >= 2 - - return bytes; - } // end decode - - /* ******** I N N E R C L A S S I N P U T S T R E A M ******** */ - - /** - * A {@link Base64.InputStream} will read data from another - * java.io.InputStream, given in the constructor, - * and encode/decode to/from Base64 notation on the fly. - * - * @see Base64 - * @since 1.3 - */ - public static class InputStream extends java.io.FilterInputStream { - - private boolean encode; // Encoding or decoding - private int position; // Current position in the buffer - private byte[] buffer; // Small buffer holding converted data - private int bufferLength; // Length of buffer (3 or 4) - private int numSigBytes; // Number of meaningful bytes in the buffer - private int lineLength; - private boolean breakLines; // Break lines at less than 80 characters - private int options; // Record options used to create the stream. - private byte[] decodabet; // Local copies to avoid extra method calls - - - /** - * Constructs a {@link Base64.InputStream} in DECODE mode. - * - * @param in the java.io.InputStream from which to read data. - * @since 1.3 - */ - public InputStream( java.io.InputStream in ) { - this( in, DECODE ); - } // end constructor - - - /** - * Constructs a {@link Base64.InputStream} in - * either ENCODE or DECODE mode. - *

- * Valid options:

-         *   ENCODE or DECODE: Encode or Decode as data is read.
-         *   DO_BREAK_LINES: break lines at 76 characters
-         *     (only meaningful when encoding)
-         * 
- *

- * Example: new Base64.InputStream( in, Base64.DECODE ) - * - * - * @param in the java.io.InputStream from which to read data. - * @param options Specified options - * @see Base64#ENCODE - * @see Base64#DECODE - * @see Base64#DO_BREAK_LINES - * @since 2.0 - */ - public InputStream( java.io.InputStream in, int options ) { - - super( in ); - this.options = options; // Record for later - this.breakLines = (options & DO_BREAK_LINES) > 0; - this.encode = (options & ENCODE) > 0; - this.bufferLength = encode ? 4 : 3; - this.buffer = new byte[ bufferLength ]; - this.position = -1; - this.lineLength = 0; - this.decodabet = getDecodabet(options); - } // end constructor - - /** - * Reads enough of the input stream to convert - * to/from Base64 and returns the next byte. - * - * @return next byte - * @since 1.3 - */ - @Override - public int read() throws java.io.IOException { - - // Do we need to get data? - if( position < 0 ) { - if( encode ) { - byte[] b3 = new byte[3]; - int numBinaryBytes = 0; - for( int i = 0; i < 3; i++ ) { - int b = in.read(); - - // If end of stream, b is -1. - if( b >= 0 ) { - b3[i] = (byte)b; - numBinaryBytes++; - } else { - break; // out of for loop - } // end else: end of stream - - } // end for: each needed input byte - - if( numBinaryBytes > 0 ) { - encode3to4( b3, 0, numBinaryBytes, buffer, 0, options ); - position = 0; - numSigBytes = 4; - } // end if: got data - else { - return -1; // Must be end of stream - } // end else - } // end if: encoding - - // Else decoding - else { - byte[] b4 = new byte[4]; - int i = 0; - for( i = 0; i < 4; i++ ) { - // Read four "meaningful" bytes: - int b = 0; - do{ b = in.read(); } - while( b >= 0 && decodabet[ b & 0x7f ] <= WHITE_SPACE_ENC ); - - if( b < 0 ) { - break; // Reads a -1 if end of stream - } // end if: end of stream - - b4[i] = (byte)b; - } // end for: each needed input byte - - if( i == 4 ) { - numSigBytes = decode4to3( b4, 0, buffer, 0, options ); - position = 0; - } // end if: got four characters - else if( i == 0 ){ - return -1; - } // end else if: also padded correctly - else { - // Must have broken out from above. - throw new java.io.IOException( "Improperly padded Base64 input." ); - } // end - - } // end else: decode - } // end else: get data - - // Got data? - if( position >= 0 ) { - // End of relevant data? - if( /*!encode &&*/ position >= numSigBytes ){ - return -1; - } // end if: got data - - if( encode && breakLines && lineLength >= MAX_LINE_LENGTH ) { - lineLength = 0; - return '\n'; - } // end if - else { - lineLength++; // This isn't important when decoding - // but throwing an extra "if" seems - // just as wasteful. - - int b = buffer[ position++ ]; - - if( position >= bufferLength ) { - position = -1; - } // end if: end - - return b & 0xFF; // This is how you "cast" a byte that's - // intended to be unsigned. - } // end else - } // end if: position >= 0 - - // Else error - else { - throw new java.io.IOException( "Error in Base64 code reading stream." ); - } // end else - } // end read - - - /** - * Calls {@link #read()} repeatedly until the end of stream - * is reached or len bytes are read. - * Returns number of bytes read into array or -1 if - * end of stream is encountered. - * - * @param dest array to hold values - * @param off offset for array - * @param len max number of bytes to read into array - * @return bytes read into array or -1 if end of stream is encountered. - * @since 1.3 - */ - @Override - public int read( byte[] dest, int off, int len ) - throws java.io.IOException { - int i; - int b; - for( i = 0; i < len; i++ ) { - b = read(); - - if( b >= 0 ) { - dest[off + i] = (byte) b; - } - else if( i == 0 ) { - return -1; - } - else { - break; // Out of 'for' loop - } // Out of 'for' loop - } // end for: each byte read - return i; - } // end read - - } // end inner class InputStream - - - - - - - /* ******** I N N E R C L A S S O U T P U T S T R E A M ******** */ - - - - /** - * A {@link Base64.OutputStream} will write data to another - * java.io.OutputStream, given in the constructor, - * and encode/decode to/from Base64 notation on the fly. - * - * @see Base64 - * @since 1.3 - */ - public static class OutputStream extends java.io.FilterOutputStream { - - private boolean encode; - private int position; - private byte[] buffer; - private int bufferLength; - private int lineLength; - private boolean breakLines; - private byte[] b4; // Scratch used in a few places - private boolean suspendEncoding; - private int options; // Record for later - private byte[] decodabet; // Local copies to avoid extra method calls - - /** - * Constructs a {@link Base64.OutputStream} in ENCODE mode. - * - * @param out the java.io.OutputStream to which data will be written. - * @since 1.3 - */ - public OutputStream( java.io.OutputStream out ) { - this( out, ENCODE ); - } // end constructor - - - /** - * Constructs a {@link Base64.OutputStream} in - * either ENCODE or DECODE mode. - *

- * Valid options:

-         *   ENCODE or DECODE: Encode or Decode as data is read.
-         *   DO_BREAK_LINES: don't break lines at 76 characters
-         *     (only meaningful when encoding)
-         * 
- *

- * Example: new Base64.OutputStream( out, Base64.ENCODE ) - * - * @param out the java.io.OutputStream to which data will be written. - * @param options Specified options. - * @see Base64#ENCODE - * @see Base64#DECODE - * @see Base64#DO_BREAK_LINES - * @since 1.3 - */ - public OutputStream( java.io.OutputStream out, int options ) { - super( out ); - this.breakLines = (options & DO_BREAK_LINES) != 0; - this.encode = (options & ENCODE) != 0; - this.bufferLength = encode ? 3 : 4; - this.buffer = new byte[ bufferLength ]; - this.position = 0; - this.lineLength = 0; - this.suspendEncoding = false; - this.b4 = new byte[4]; - this.options = options; - this.decodabet = getDecodabet(options); - } // end constructor - - - /** - * Writes the byte to the output stream after - * converting to/from Base64 notation. - * When encoding, bytes are buffered three - * at a time before the output stream actually - * gets a write() call. - * When decoding, bytes are buffered four - * at a time. - * - * @param theByte the byte to write - * @since 1.3 - */ - @Override - public void write(int theByte) - throws java.io.IOException { - // Encoding suspended? - if( suspendEncoding ) { - this.out.write( theByte ); - return; - } // end if: supsended - - // Encode? - if( encode ) { - buffer[ position++ ] = (byte)theByte; - if( position >= bufferLength ) { // Enough to encode. - - this.out.write( encode3to4( b4, buffer, bufferLength, options ) ); - - lineLength += 4; - if( breakLines && lineLength >= MAX_LINE_LENGTH ) { - this.out.write( NEW_LINE ); - lineLength = 0; - } // end if: end of line - - position = 0; - } // end if: enough to output - } // end if: encoding - - // Else, Decoding - else { - // Meaningful Base64 character? - if( decodabet[ theByte & 0x7f ] > WHITE_SPACE_ENC ) { - buffer[ position++ ] = (byte)theByte; - if( position >= bufferLength ) { // Enough to output. - - int len = Base64.decode4to3( buffer, 0, b4, 0, options ); - out.write( b4, 0, len ); - position = 0; - } // end if: enough to output - } // end if: meaningful base64 character - else if( decodabet[ theByte & 0x7f ] != WHITE_SPACE_ENC ) { - throw new java.io.IOException( "Invalid character in Base64 data." ); - } // end else: not white space either - } // end else: decoding - } // end write - - - - /** - * Calls {@link #write(int)} repeatedly until len - * bytes are written. - * - * @param theBytes array from which to read bytes - * @param off offset for array - * @param len max number of bytes to read into array - * @since 1.3 - */ - @Override - public void write( byte[] theBytes, int off, int len ) - throws java.io.IOException { - // Encoding suspended? - if( suspendEncoding ) { - this.out.write( theBytes, off, len ); - return; - } // end if: supsended - - for( int i = 0; i < len; i++ ) { - write( theBytes[ off + i ] ); - } // end for: each byte written - - } // end write - - - - /** - * Method added by PHIL. [Thanks, PHIL. -Rob] - * This pads the buffer without closing the stream. - * @throws java.io.IOException if there's an error. - */ - public void flushBase64() throws java.io.IOException { - if( position > 0 ) { - if( encode ) { - out.write( encode3to4( b4, buffer, position, options ) ); - position = 0; - } // end if: encoding - else { - throw new java.io.IOException( "Base64 input not properly padded." ); - } // end else: decoding - } // end if: buffer partially full - - } // end flush - - - /** - * Flushes and closes (I think, in the superclass) the stream. - * - * @since 1.3 - */ - @Override - public void close() throws java.io.IOException { - // 1. Ensure that pending characters are written - flushBase64(); - - // 2. Actually close the stream - // Base class both flushes and closes. - super.close(); - - buffer = null; - out = null; - } // end close - - - - /** - * Suspends encoding of the stream. - * May be helpful if you need to embed a piece of - * base64-encoded data in a stream. - * - * @throws java.io.IOException if there's an error flushing - * @since 1.5.1 - */ - public void suspendEncoding() throws java.io.IOException { - flushBase64(); - this.suspendEncoding = true; - } // end suspendEncoding - - - /** - * Resumes encoding of the stream. - * May be helpful if you need to embed a piece of - * base64-encoded data in a stream. - * - * @since 1.5.1 - */ - public void resumeEncoding() { - this.suspendEncoding = false; - } // end resumeEncoding - - - - } // end inner class OutputStream - - -} // end class Base64 diff --git a/authz-client/src/main/java/org/keycloak/common/util/CollectionUtil.java b/authz-client/src/main/java/org/keycloak/common/util/CollectionUtil.java deleted file mode 100644 index c546b05..0000000 --- a/authz-client/src/main/java/org/keycloak/common/util/CollectionUtil.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.common.util; - -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * @author Jeroen Rosenberg - */ -public class CollectionUtil { - - public static String join(Collection strings) { - return join(strings, ", "); - } - - public static String join(Collection strings, String separator) { - return strings.stream().collect(Collectors.joining(String.valueOf(separator))); - } - - // Return true if all items from col1 are in col2 and viceversa. Order is not taken into account - public static boolean collectionEquals(Collection col1, Collection col2) { - if (col1.size()!=col2.size()) { - return false; - } - Map countMap = new HashMap<>(); - for(T o : col1) { - countMap.merge(o, 1, (v1, v2) -> v1 + v2); - } - for(T o : col2) { - Integer v = countMap.get(o); - if (v==null) { - return false; - } - if (v == 1) { - countMap.remove(o); - } else { - countMap.put(o, v-1); - } - } - return countMap.isEmpty(); - } - - public static boolean isEmpty(Collection collection) { - return collection == null || collection.isEmpty(); - } - - public static boolean isNotEmpty(Collection collection) { - return !isEmpty(collection); - } - - public static Set collectionToSet(Collection collection) { - return collection == null ? null : new HashSet<>(collection); - } -} diff --git a/authz-client/src/main/java/org/keycloak/common/util/MultivaluedHashMap.java b/authz-client/src/main/java/org/keycloak/common/util/MultivaluedHashMap.java deleted file mode 100755 index e2e3bb4..0000000 --- a/authz-client/src/main/java/org/keycloak/common/util/MultivaluedHashMap.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.common.util; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -@SuppressWarnings("serial") -public class MultivaluedHashMap extends HashMap> implements MultivaluedMap -{ - public MultivaluedHashMap() { - } - - public MultivaluedHashMap(Map> map) { - if (map == null) { - throw new IllegalArgumentException("Map can not be null"); - } - putAll(map); - } - - - public MultivaluedHashMap(MultivaluedHashMap config) { - addAll(config); - } -} diff --git a/authz-client/src/main/java/org/keycloak/common/util/MultivaluedMap.java b/authz-client/src/main/java/org/keycloak/common/util/MultivaluedMap.java deleted file mode 100644 index 54cdfe4..0000000 --- a/authz-client/src/main/java/org/keycloak/common/util/MultivaluedMap.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2024 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.common.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -public interface MultivaluedMap extends Map> { - - public default void putSingle(K key, V value) { - List list = createListInstance(); - list.add(value); - put(key, list); // Just override with new List instance - } - - public default void addAll(K key, V... newValues) { - for (V value : newValues) { - add(key, value); - } - } - - public default void addAll(K key, List valueList) { - for (V value : valueList) { - add(key, value); - } - } - - public default void addFirst(K key, V value) { - getList(key).add(0, value); - } - - public default void add(K key, V value) { - getList(key).add(value); - } - - public default void addMultiple(K key, Collection values) { - getList(key).addAll(values); - } - - public default V getFirst(K key) { - return Optional.ofNullable(get(key)).filter(l -> !l.isEmpty()).map(l -> l.get(0)).orElse(null); - } - - public default List getList(K key) { - return compute(key, (k, v) -> v != null ? v : createListInstance()); - } - - public default void addAll(MultivaluedMap other) { - for (Entry> entry : other.entrySet()) { - getList(entry.getKey()).addAll(entry.getValue()); - } - } - - public default boolean equalsIgnoreValueOrder(MultivaluedMap omap) { - if (this == omap) { - return true; - } - if (!keySet().equals(omap.keySet())) { - return false; - } - for (Map.Entry> e : entrySet()) { - List list = e.getValue(); - List olist = omap.get(e.getKey()); - if (!CollectionUtil.collectionEquals(list, olist)) { - return false; - } - } - return true; - } - - public default List createListInstance() { - return new ArrayList<>(); - } - -} diff --git a/authz-client/src/main/java/org/keycloak/common/util/ObjectUtil.java b/authz-client/src/main/java/org/keycloak/common/util/ObjectUtil.java deleted file mode 100644 index 2dd9bab..0000000 --- a/authz-client/src/main/java/org/keycloak/common/util/ObjectUtil.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.common.util; - -/** - * @author Marek Posolda - */ -public class ObjectUtil { - - private ObjectUtil() {} - - /** - * - * @param str1 - * @param str2 - * @return true if both strings are null or equal - */ - public static boolean isEqualOrBothNull(Object str1, Object str2) { - if (str1 == null && str2 == null) { - return true; - } - - if ((str1 != null && str2 == null) || (str1 == null && str2 != null)) { - return false; - } - - return str1.equals(str2); - } - - - public static String capitalize(String str) { - return str.substring(0, 1).toUpperCase() + str.substring(1); - } - - - /** - * Forked from apache-commons StringUtils - * - *

Checks if a CharSequence is whitespace, empty ("") or null.

- * - *
-     * ObjectUtil.isBlank(null)      = true
-     * ObjectUtil.isBlank("")        = true
-     * ObjectUtil.isBlank(" ")       = true
-     * ObjectUtil.isBlank("bob")     = false
-     * ObjectUtil.isBlank("  bob  ") = false
-     * 
- * - * @param cs - * @return {@code true} if the CharSequence is null, empty or whitespace - */ - public static boolean isBlank(final CharSequence cs) { - int strLen; - if (cs == null || (strLen = cs.length()) == 0) { - return true; - } - for (int i = 0; i < strLen; i++) { - if (!Character.isWhitespace(cs.charAt(i))) { - return false; - } - } - return true; - } -} diff --git a/authz-client/src/main/java/org/keycloak/common/util/StringPropertyReplacer.java b/authz-client/src/main/java/org/keycloak/common/util/StringPropertyReplacer.java deleted file mode 100755 index c48d022..0000000 --- a/authz-client/src/main/java/org/keycloak/common/util/StringPropertyReplacer.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.common.util; - -import java.io.File; -import java.util.Properties; - -/** - * A utility class for replacing properties in strings. - * - * @author Jason Dillon - * @author Scott Stark - * @author Claudio Vesco - * @author Adrian Brock - * @author Dimitris Andreadis - * @version $Revision: 2898 $ - */ -public final class StringPropertyReplacer -{ - /** New line string constant */ - public static final String NEWLINE = System.getProperty("line.separator", "\n"); - - /** File separator value */ - private static final String FILE_SEPARATOR = File.separator; - - /** Path separator value */ - private static final String PATH_SEPARATOR = File.pathSeparator; - - /** File separator alias */ - private static final String FILE_SEPARATOR_ALIAS = "/"; - - /** Path separator alias */ - private static final String PATH_SEPARATOR_ALIAS = ":"; - - // States used in property parsing - private static final int NORMAL = 0; - private static final int SEEN_DOLLAR = 1; - private static final int IN_BRACKET = 2; - - private static final Properties systemEnvProperties = new SystemEnvProperties(); - - /** - * Go through the input string and replace any occurrence of ${p} with - * the System.getProperty(p) value. If there is no such property p defined, - * then the ${p} reference will remain unchanged. - * - * If the property reference is of the form ${p:v} and there is no such property p, - * then the default value v will be returned. - * - * If the property reference is of the form ${p1,p2} or ${p1,p2:v} then - * the primary and the secondary properties will be tried in turn, before - * returning either the unchanged input, or the default value. - * - * The property ${/} is replaced with System.getProperty("file.separator") - * value and the property ${:} is replaced with System.getProperty("path.separator"). - * - * @param string - the string with possible ${} references - * @return the input string with all property references replaced if any. - * If there are no valid references the input string will be returned. - */ - public static String replaceProperties(final String string) - { - return replaceProperties(string, (Properties) null); - } - - /** - * Go through the input string and replace any occurrence of ${p} with - * the props.getProperty(p) value. If there is no such property p defined, - * then the ${p} reference will remain unchanged. - * - * If the property reference is of the form ${p:v} and there is no such property p, - * then the default value v will be returned. - * - * If the property reference is of the form ${p1,p2} or ${p1,p2:v} then - * the primary and the secondary properties will be tried in turn, before - * returning either the unchanged input, or the default value. - * - * The property ${/} is replaced with System.getProperty("file.separator") - * value and the property ${:} is replaced with System.getProperty("path.separator"). - * - * @param string - the string with possible ${} references - * @param props - the source for ${x} property ref values, null means use System.getProperty() - * @return the input string with all property references replaced if any. - * If there are no valid references the input string will be returned. - */ - public static String replaceProperties(final String string, final Properties props) { - if (props == null) { - return replaceProperties(string, (PropertyResolver) null); - } - return replaceProperties(string, props::getProperty); - } - - public static String replaceProperties(final String string, PropertyResolver resolver) - { - if(string == null) { - return null; - } - final char[] chars = string.toCharArray(); - StringBuilder buffer = new StringBuilder(); - boolean properties = false; - int state = NORMAL; - int start = 0; - int openBracketsCount = 0; - for (int i = 0; i < chars.length; ++i) - { - char c = chars[i]; - - // Dollar sign outside brackets - if (c == '$' && state != IN_BRACKET) - state = SEEN_DOLLAR; - - // Open bracket immediately after dollar - else if (c == '{' && state == SEEN_DOLLAR) - { - buffer.append(string.substring(start, i - 1)); - state = IN_BRACKET; - start = i - 1; - openBracketsCount = 1; - } - - // Seeing open bracket after we already saw some open bracket without corresponding closed bracket. This causes "nested" expressions. For example ${foo:${bar}} - else if (c == '{' && state == IN_BRACKET) - openBracketsCount++; - - // No open bracket after dollar - else if (state == SEEN_DOLLAR) - state = NORMAL; - - // Seeing closed bracket, but we already saw more than one open bracket before. Hence "nested" expression is still not fully closed. - // For example expression ${foo:${bar}} is closed after the second closed bracket, not after the first closed bracket. - else if (c == '}' && state == IN_BRACKET && openBracketsCount > 1) - openBracketsCount--; - - // Closed bracket after open bracket - else if (c == '}' && state == IN_BRACKET) - { - // No content - if (start + 2 == i) - { - buffer.append("${}"); // REVIEW: Correct? - } - else // Collect the system property - { - String value = null; - - String key = string.substring(start + 2, i); - - // check for alias - if (FILE_SEPARATOR_ALIAS.equals(key)) - { - value = FILE_SEPARATOR; - } - else if (PATH_SEPARATOR_ALIAS.equals(key)) - { - value = PATH_SEPARATOR; - } - else - { - // check from the properties - if (resolver != null) - value = resolver.resolve(key); - else - value = systemEnvProperties.getProperty(key); - - if (value == null) - { - // Check for a default value ${key:default} - int colon = key.indexOf(':'); - if (colon > 0) - { - String realKey = key.substring(0, colon); - if (resolver != null) - value = resolver.resolve(realKey); - else - value = systemEnvProperties.getProperty(realKey); - - if (value == null) - { - // Check for a composite key, "key1,key2" - value = resolveCompositeKey(realKey, resolver); - - // Not a composite key either, use the specified default - if (value == null) - value = key.substring(colon+1); - } - } - else - { - // No default, check for a composite key, "key1,key2" - value = resolveCompositeKey(key, resolver); - } - } - } - - if (value != null) - { - properties = true; - buffer.append(value); - } - else - { - buffer.append("${"); - buffer.append(key); - buffer.append('}'); - } - - } - start = i + 1; - state = NORMAL; - } - } - - // No properties - if (!properties) - return string; - - // Collect the trailing characters - if (start != chars.length) - buffer.append(string.substring(start, chars.length)); - - if (buffer.indexOf("${") != -1) { - try { - return replaceProperties(buffer.toString(), resolver); - } catch (StackOverflowError ex) { - throw new IllegalStateException("Infinite recursion happening when replacing properties on '" + buffer + "'"); - } - } - - // Done - return buffer.toString(); - } - - private static String resolveCompositeKey(String key, PropertyResolver resolver) - { - String value = null; - - // Look for the comma - int comma = key.indexOf(','); - if (comma > -1) - { - // If we have a first part, try resolve it - if (comma > 0) - { - // Check the first part - String key1 = key.substring(0, comma); - if (resolver != null) - value = resolver.resolve(key1); - else - value = systemEnvProperties.getProperty(key1); - } - // Check the second part, if there is one and first lookup failed - if (value == null && comma < key.length() - 1) - { - String key2 = key.substring(comma + 1); - if (resolver != null) - value = resolver.resolve(key2); - else - value = systemEnvProperties.getProperty(key2); - } - } - // Return whatever we've found or null - return value; - } - - public interface PropertyResolver { - String resolve(String property); - } -} diff --git a/authz-client/src/main/java/org/keycloak/common/util/SystemEnvProperties.java b/authz-client/src/main/java/org/keycloak/common/util/SystemEnvProperties.java deleted file mode 100644 index 78fc4c7..0000000 --- a/authz-client/src/main/java/org/keycloak/common/util/SystemEnvProperties.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.common.util; - -import java.util.Collections; -import java.util.Map; -import java.util.Properties; - -/** - * @author Stian Thorgersen - */ -public class SystemEnvProperties extends Properties { - - private final Map overrides; - - public SystemEnvProperties(Map overrides) { - this.overrides = overrides; - } - - public SystemEnvProperties() { - this.overrides = Collections.EMPTY_MAP; - } - - @Override - public String getProperty(String key) { - if (overrides.containsKey(key)) { - return overrides.get(key); - } else if (key.startsWith("env.")) { - return System.getenv().get(key.substring(4)); - } else { - return System.getProperty(key); - } - } - - @Override - public String getProperty(String key, String defaultValue) { - String value = getProperty(key); - return value != null ? value : defaultValue; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/common/util/Time.java b/authz-client/src/main/java/org/keycloak/common/util/Time.java deleted file mode 100644 index ef4187c..0000000 --- a/authz-client/src/main/java/org/keycloak/common/util/Time.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.common.util; - -import java.util.Date; - -/** - * @author Stian Thorgersen - */ -public class Time { - - private static volatile int offset; - - /** - * Returns current time in seconds adjusted by adding {@link #offset) seconds. - * @return see description - */ - public static int currentTime() { - return ((int) (System.currentTimeMillis() / 1000)) + offset; - } - - /** - * Returns current time in milliseconds adjusted by adding {@link #offset) seconds. - * @return see description - */ - public static long currentTimeMillis() { - return System.currentTimeMillis() + (offset * 1000L); - } - - /** - * Returns {@link Date} object, its value set to time - * @param time Time in milliseconds since the epoch - * @return see description - */ - public static Date toDate(int time) { - return new Date(time * 1000L); - } - - /** - * Returns {@link Date} object, its value set to time - * @param time Time in milliseconds since the epoch - * @return see description - */ - public static Date toDate(long time) { - return new Date(time); - } - - /** - * Returns time in milliseconds for a time in seconds. No adjustment is made to the parameter. - * @param time Time in seconds since the epoch - * @return Time in milliseconds - */ - public static long toMillis(long time) { - return time * 1000L; - } - - /** - * @return Time offset in seconds that will be added to {@link #currentTime()} and {@link #currentTimeMillis()}. - */ - public static int getOffset() { - return offset; - } - - /** - * Sets time offset in seconds that will be added to {@link #currentTime()} and {@link #currentTimeMillis()}. - * @param offset Offset (in seconds) - */ - public static void setOffset(int offset) { - Time.offset = offset; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/crypto/Algorithm.java b/authz-client/src/main/java/org/keycloak/crypto/Algorithm.java deleted file mode 100755 index ab6efb6..0000000 --- a/authz-client/src/main/java/org/keycloak/crypto/Algorithm.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.crypto; - -import org.keycloak.common.crypto.CryptoConstants; - -public interface Algorithm { - - /* RSA signing algorithms */ - String HS256 = "HS256"; - String HS384 = "HS384"; - String HS512 = "HS512"; - String RS256 = "RS256"; - String RS384 = "RS384"; - String RS512 = "RS512"; - String PS256 = "PS256"; - String PS384 = "PS384"; - String PS512 = "PS512"; - - /* ECDSA signing algorithms */ - String ES256 = "ES256"; - String ES384 = "ES384"; - String ES512 = "ES512"; - - /* EdDSA signing algorithms */ - String EdDSA = "EdDSA"; - /* EdDSA Curve */ - String Ed25519 = "Ed25519"; - String Ed448 = "Ed448"; - - /* RSA Encryption Algorithms */ - String RSA1_5 = CryptoConstants.RSA1_5; - String RSA_OAEP = CryptoConstants.RSA_OAEP; - String RSA_OAEP_256 = CryptoConstants.RSA_OAEP_256; - - /* AES */ - String AES = "AES"; - - String ECDH_ES = CryptoConstants.ECDH_ES; - String ECDH_ES_A128KW = CryptoConstants.ECDH_ES_A128KW; - String ECDH_ES_A192KW = CryptoConstants.ECDH_ES_A192KW; - String ECDH_ES_A256KW = CryptoConstants.ECDH_ES_A256KW; -} diff --git a/authz-client/src/main/java/org/keycloak/crypto/KeyUse.java b/authz-client/src/main/java/org/keycloak/crypto/KeyUse.java deleted file mode 100644 index ddf6d06..0000000 --- a/authz-client/src/main/java/org/keycloak/crypto/KeyUse.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.crypto; - -public enum KeyUse { - - SIG("sig"), - ENC("enc"); - - private String specName; - - KeyUse(String specName) { - this.specName = specName; - } - - public String getSpecName() { - return specName; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/jose/jwk/JWKBuilder.java b/authz-client/src/main/java/org/keycloak/jose/jwk/JWKBuilder.java deleted file mode 100644 index 282dbd3..0000000 --- a/authz-client/src/main/java/org/keycloak/jose/jwk/JWKBuilder.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.jose.jwk; - -import org.keycloak.crypto.KeyUse; - -import java.security.Key; - -/** - * @author Stian Thorgersen - */ -public class JWKBuilder extends AbstractJWKBuilder { - - public static JWKBuilder create() { - return new JWKBuilder(); - } - - public JWKBuilder kid(String kid) { - this.kid = kid; - return this; - } - - public JWKBuilder algorithm(String algorithm) { - this.algorithm = algorithm; - return this; - } - - @Override - public JWK okp(Key key) { - // not supported if jdk vesion < 17 - throw new UnsupportedOperationException("EdDSA algorithms not supported in this JDK version"); - } - - @Override - public JWK okp(Key key, KeyUse keyUse) { - // not supported if jdk version < 17 - throw new UnsupportedOperationException("EdDSA algorithms not supported in this JDK version"); - } -} diff --git a/authz-client/src/main/java/org/keycloak/jose/jwk/JWKParser.java b/authz-client/src/main/java/org/keycloak/jose/jwk/JWKParser.java deleted file mode 100755 index 13820e3..0000000 --- a/authz-client/src/main/java/org/keycloak/jose/jwk/JWKParser.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.jose.jwk; - -import org.keycloak.util.JsonSerialization; - -/** - * @author Stian Thorgersen - */ -public class JWKParser extends AbstractJWKParser { - - protected JWKParser() { - } - - public JWKParser(JWK jwk) { - this.jwk = jwk; - } - - public static JWKParser create() { - return new JWKParser(); - } - - public static JWKParser create(JWK jwk) { - return new JWKParser(jwk); - } - - public JWKParser parse(String jwk) { - try { - this.jwk = JsonSerialization.mapper.readValue(jwk, JWK.class); - return this; - } catch (Exception e) { - throw new RuntimeException(e); - } - } - -} diff --git a/authz-client/src/main/java/org/keycloak/json/StringListMapDeserializer.java b/authz-client/src/main/java/org/keycloak/json/StringListMapDeserializer.java deleted file mode 100644 index 1241fd0..0000000 --- a/authz-client/src/main/java/org/keycloak/json/StringListMapDeserializer.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.json; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -public class StringListMapDeserializer extends JsonDeserializer { - - @Override - public Object deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { - JsonNode jsonNode = jsonParser.readValueAsTree(); - Iterator> itr = jsonNode.fields(); - Map> map = new HashMap<>(); - while (itr.hasNext()) { - Map.Entry e = itr.next(); - List values = new LinkedList<>(); - if (!e.getValue().isArray()) { - values.add((e.getValue().isNull()) ? null : e.getValue().asText()); - } else { - ArrayNode a = (ArrayNode) e.getValue(); - Iterator vitr = a.elements(); - while (vitr.hasNext()) { - JsonNode node = vitr.next(); - values.add((node.isNull() ? null : node.asText())); - } - } - map.put(e.getKey(), values); - } - return map; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/json/StringOrArrayDeserializer.java b/authz-client/src/main/java/org/keycloak/json/StringOrArrayDeserializer.java deleted file mode 100644 index 42ce211..0000000 --- a/authz-client/src/main/java/org/keycloak/json/StringOrArrayDeserializer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.json; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.databind.JsonNode; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; - -public class StringOrArrayDeserializer extends JsonDeserializer { - - @Override - public Object deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { - JsonNode jsonNode = jsonParser.readValueAsTree(); - if (jsonNode.isArray()) { - ArrayList a = new ArrayList<>(1); - Iterator itr = jsonNode.iterator(); - while (itr.hasNext()) { - a.add(itr.next().textValue()); - } - return a.toArray(new String[a.size()]); - } else { - return new String[] { jsonNode.textValue() }; - } - } - -} diff --git a/authz-client/src/main/java/org/keycloak/json/StringOrArraySerializer.java b/authz-client/src/main/java/org/keycloak/json/StringOrArraySerializer.java deleted file mode 100644 index 1e9ce1e..0000000 --- a/authz-client/src/main/java/org/keycloak/json/StringOrArraySerializer.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.json; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - -import java.io.IOException; - -public class StringOrArraySerializer extends JsonSerializer { - @Override - public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { - String[] array = (String[]) o; - if (array == null) { - jsonGenerator.writeNull(); - } else if (array.length == 1) { - jsonGenerator.writeString(array[0]); - } else { - jsonGenerator.writeStartArray(); - for (String s : array) { - jsonGenerator.writeString(s); - } - jsonGenerator.writeEndArray(); - } - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/AccessToken.java b/authz-client/src/main/java/org/keycloak/representations/AccessToken.java deleted file mode 100755 index d16b724..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/AccessToken.java +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.keycloak.TokenCategory; -import org.keycloak.representations.idm.authorization.Permission; - -import java.io.Serializable; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class AccessToken extends IDToken { - public static class Access implements Serializable { - @JsonProperty("roles") - protected Set roles; - @JsonProperty("verify_caller") - protected Boolean verifyCaller; - - public Access() { - } - - public Access clone() { - Access access = new Access(); - access.verifyCaller = verifyCaller; - if (roles != null) { - access.roles = new HashSet<>(); - access.roles.addAll(roles); - } - return access; - } - - public Set getRoles() { - return roles; - } - - public Access roles(Set roles) { - this.roles = roles; - return this; - } - - @JsonIgnore - public boolean isUserInRole(String role) { - if (roles == null) return false; - return roles.contains(role); - } - - public Access addRole(String role) { - if (roles == null) roles = new HashSet<>(); - roles.add(role); - return this; - } - - public Boolean getVerifyCaller() { - return verifyCaller; - } - - public Access verifyCaller(Boolean required) { - this.verifyCaller = required; - return this; - } - } - - public static class Authorization implements Serializable { - - @JsonProperty("permissions") - private Collection permissions; - - public Collection getPermissions() { - return permissions; - } - - public void setPermissions(Collection permissions) { - this.permissions = permissions; - } - } - - // KEYCLOAK-6771 Certificate Bound Token - // https://tools.ietf.org/html/draft-ietf-oauth-mtls-08#section-3.1 - public static class Confirmation { - @JsonProperty("x5t#S256") - protected String certThumbprint; - - @JsonProperty("jkt") - protected String keyThumbprint; - - public String getCertThumbprint() { - return certThumbprint; - } - - public void setCertThumbprint(String certThumbprint) { - this.certThumbprint = certThumbprint; - } - - public String getKeyThumbprint() { - return keyThumbprint; - } - - public void setKeyThumbprint(String keyThumbprint) { - this.keyThumbprint = keyThumbprint; - } - } - - @JsonProperty("trusted-certs") - protected Set trustedCertificates; - - @JsonProperty("allowed-origins") - protected Set allowedOrigins; - - @JsonProperty("realm_access") - protected Access realmAccess; - - @JsonProperty("resource_access") - protected Map resourceAccess; - - @JsonProperty("authorization") - protected Authorization authorization; - - @JsonProperty("cnf") - protected Confirmation confirmation; - - @JsonProperty("scope") - protected String scope; - - @JsonIgnore - public Map getResourceAccess() { - return resourceAccess == null ? Collections.emptyMap() : resourceAccess; - } - - public void setResourceAccess(Map resourceAccess) { - this.resourceAccess = resourceAccess; - } - - - - - /** - * Does the realm require verifying the caller? - * - * @return - */ - @JsonIgnore - public boolean isVerifyCaller() { - if (getRealmAccess() != null && getRealmAccess().getVerifyCaller() != null) - return getRealmAccess().getVerifyCaller().booleanValue(); - return false; - } - - /** - * Does the resource override the requirement of verifying the caller? - * - * @param resource - * @return - */ - @JsonIgnore - public boolean isVerifyCaller(String resource) { - Access access = getResourceAccess(resource); - if (access != null && access.getVerifyCaller() != null) return access.getVerifyCaller().booleanValue(); - return false; - } - - @JsonIgnore - public Access getResourceAccess(String resource) { - return resourceAccess == null ? null : resourceAccess.get(resource); - } - - public Access addAccess(String service) { - if (resourceAccess == null) { - resourceAccess = new HashMap<>(); - } - - Access access = resourceAccess.get(service); - if (access != null) return access; - access = new Access(); - resourceAccess.put(service, access); - return access; - } - - @Override - public AccessToken id(String id) { - return (AccessToken) super.id(id); - } - - @Override - public AccessToken issuer(String issuer) { - return (AccessToken) super.issuer(issuer); - } - - @Override - public AccessToken subject(String subject) { - return (AccessToken) super.subject(subject); - } - - @Override - public AccessToken type(String type) { - return (AccessToken) super.type(type); - } - - public Set getAllowedOrigins() { - return allowedOrigins; - } - - public void setAllowedOrigins(Set allowedOrigins) { - this.allowedOrigins = allowedOrigins; - } - - public Access getRealmAccess() { - return realmAccess; - } - - public void setRealmAccess(Access realmAccess) { - this.realmAccess = realmAccess; - } - - public Set getTrustedCertificates() { - return trustedCertificates; - } - - public void setTrustedCertificates(Set trustedCertificates) { - this.trustedCertificates = trustedCertificates; - } - - @Override - public AccessToken issuedFor(String issuedFor) { - return (AccessToken)super.issuedFor(issuedFor); - } - - public Authorization getAuthorization() { - return authorization; - } - - public void setAuthorization(Authorization authorization) { - this.authorization = authorization; - } - - public Confirmation getConfirmation() { - return confirmation; - } - - public void setConfirmation(Confirmation confirmation) { - this.confirmation = confirmation; - } - - public String getScope() { - return scope; - } - - public void setScope(String scope) { - this.scope = scope; - } - - @Override - public TokenCategory getCategory() { - return TokenCategory.ACCESS; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/AccessTokenResponse.java b/authz-client/src/main/java/org/keycloak/representations/AccessTokenResponse.java deleted file mode 100755 index b3e7020..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/AccessTokenResponse.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.HashMap; -import java.util.Map; - -/** - * OAuth 2.0 Access Token Response json - * - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class AccessTokenResponse { - @JsonProperty("access_token") - protected String token; - - @JsonProperty("expires_in") - protected long expiresIn; - - @JsonProperty("refresh_expires_in") - protected long refreshExpiresIn; - - @JsonProperty("refresh_token") - protected String refreshToken; - - @JsonProperty("token_type") - protected String tokenType; - - @JsonProperty("id_token") - protected String idToken; - - @JsonProperty("not-before-policy") - protected int notBeforePolicy; - - @JsonProperty("session_state") - protected String sessionState; - - protected Map otherClaims = new HashMap<>(); - - // OIDC Financial API Read Only Profile : scope MUST be returned in the response from Token Endpoint - @JsonProperty("scope") - protected String scope; - - @JsonProperty("error") - protected String error; - - @JsonProperty("error_description") - protected String errorDescription; - - @JsonProperty("error_uri") - protected String errorUri; - - public String getScope() { - return scope; - } - - public void setScope(String scope) { - this.scope = scope; - } - - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - public long getExpiresIn() { - return expiresIn; - } - - public void setExpiresIn(long expiresIn) { - this.expiresIn = expiresIn; - } - - public long getRefreshExpiresIn() { - return refreshExpiresIn; - } - - public void setRefreshExpiresIn(long refreshExpiresIn) { - this.refreshExpiresIn = refreshExpiresIn; - } - - public String getRefreshToken() { - return refreshToken; - } - - public void setRefreshToken(String refreshToken) { - this.refreshToken = refreshToken; - } - - public String getTokenType() { - return tokenType; - } - - public void setTokenType(String tokenType) { - this.tokenType = tokenType; - } - - public String getIdToken() { - return idToken; - } - - public void setIdToken(String idToken) { - this.idToken = idToken; - } - - public int getNotBeforePolicy() { - return notBeforePolicy; - } - - public void setNotBeforePolicy(int notBeforePolicy) { - this.notBeforePolicy = notBeforePolicy; - } - - public String getSessionState() { - return sessionState; - } - - public void setSessionState(String sessionState) { - this.sessionState = sessionState; - } - - @JsonAnyGetter - public Map getOtherClaims() { - return otherClaims; - } - - @JsonAnySetter - public void setOtherClaims(String name, Object value) { - otherClaims.put(name, value); - } - - public String getError() { - return error; - } - - public void setError(String error) { - this.error = error; - } - - public String getErrorDescription() { - return errorDescription; - } - - public void setErrorDescription(String errorDescription) { - this.errorDescription = errorDescription; - } - - public String getErrorUri() { - return errorUri; - } - - public void setErrorUri(String errorUri) { - this.errorUri = errorUri; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/AddressClaimSet.java b/authz-client/src/main/java/org/keycloak/representations/AddressClaimSet.java deleted file mode 100755 index 30a1bba..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/AddressClaimSet.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** -* @author Bill Burke -* @version $Revision: 1 $ -*/ -public class AddressClaimSet { - public static final String FORMATTED = "formatted"; - public static final String STREET_ADDRESS = "street_address"; - public static final String LOCALITY = "locality"; - public static final String REGION = "region"; - public static final String POSTAL_CODE = "postal_code"; - public static final String COUNTRY = "country"; - - @JsonProperty(FORMATTED) - protected String formattedAddress; - - @JsonProperty(STREET_ADDRESS) - protected String streetAddress; - - @JsonProperty(LOCALITY) - protected String locality; - - @JsonProperty(REGION) - protected String region; - - @JsonProperty(POSTAL_CODE) - protected String postalCode; - - @JsonProperty(COUNTRY) - protected String country; - - public String getFormattedAddress() { - return this.formattedAddress; - } - - public void setFormattedAddress(String formattedAddress) { - this.formattedAddress = formattedAddress; - } - - public String getStreetAddress() { - return this.streetAddress; - } - - public void setStreetAddress(String streetAddress) { - this.streetAddress = streetAddress; - } - - public String getLocality() { - return this.locality; - } - - public void setLocality(String locality) { - this.locality = locality; - } - - public String getRegion() { - return this.region; - } - - public void setRegion(String region) { - this.region = region; - } - - public String getPostalCode() { - return this.postalCode; - } - - public void setPostalCode(String postalCode) { - this.postalCode = postalCode; - } - - public String getCountry() { - return this.country; - } - - public void setCountry(String country) { - this.country = country; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/IDToken.java b/authz-client/src/main/java/org/keycloak/representations/IDToken.java deleted file mode 100755 index 8f7f259..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/IDToken.java +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.keycloak.TokenCategory; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class IDToken extends JsonWebToken { - public static final String NONCE = "nonce"; - public static final String AUTH_TIME = "auth_time"; - public static final String SESSION_STATE = "session_state"; - public static final String AT_HASH = "at_hash"; - public static final String C_HASH = "c_hash"; - public static final String NAME = "name"; - public static final String GIVEN_NAME = "given_name"; - public static final String FAMILY_NAME = "family_name"; - public static final String MIDDLE_NAME = "middle_name"; - public static final String NICKNAME = "nickname"; - public static final String PREFERRED_USERNAME = "preferred_username"; - public static final String PROFILE = "profile"; - public static final String PICTURE = "picture"; - public static final String WEBSITE = "website"; - public static final String EMAIL = "email"; - public static final String EMAIL_VERIFIED = "email_verified"; - public static final String GENDER = "gender"; - public static final String BIRTHDATE = "birthdate"; - public static final String ZONEINFO = "zoneinfo"; - public static final String LOCALE = "locale"; - public static final String PHONE_NUMBER = "phone_number"; - public static final String PHONE_NUMBER_VERIFIED = "phone_number_verified"; - public static final String ADDRESS = "address"; - public static final String UPDATED_AT = "updated_at"; - public static final String CLAIMS_LOCALES = "claims_locales"; - public static final String ACR = "acr"; - public static final String SESSION_ID = "sid"; - - // Financial API - Part 2: Read and Write API Security Profile - // http://openid.net/specs/openid-financial-api-part-2.html#authorization-server - public static final String S_HASH = "s_hash"; - - // NOTE!!! WE used to use @JsonUnwrapped on a UserClaimSet object. This screws up otherClaims and the won't work - // anymore. So don't have any @JsonUnwrapped! - @JsonProperty(NONCE) - protected String nonce; - - protected Long auth_time; - - @JsonProperty(SESSION_ID) - protected String sessionId; - - @JsonProperty(AT_HASH) - protected String accessTokenHash; - - @JsonProperty(C_HASH) - protected String codeHash; - - @JsonProperty(NAME) - protected String name; - - @JsonProperty(GIVEN_NAME) - protected String givenName; - - @JsonProperty(FAMILY_NAME) - protected String familyName; - - @JsonProperty(MIDDLE_NAME) - protected String middleName; - - @JsonProperty(NICKNAME) - protected String nickName; - - @JsonProperty(PREFERRED_USERNAME) - protected String preferredUsername; - - @JsonProperty(PROFILE) - protected String profile; - - @JsonProperty(PICTURE) - protected String picture; - - @JsonProperty(WEBSITE) - protected String website; - - @JsonProperty(EMAIL) - protected String email; - - @JsonProperty(EMAIL_VERIFIED) - protected Boolean emailVerified; - - @JsonProperty(GENDER) - protected String gender; - - @JsonProperty(BIRTHDATE) - protected String birthdate; - - @JsonProperty(ZONEINFO) - protected String zoneinfo; - - @JsonProperty(LOCALE) - protected String locale; - - @JsonProperty(PHONE_NUMBER) - protected String phoneNumber; - - @JsonProperty(PHONE_NUMBER_VERIFIED) - protected Boolean phoneNumberVerified; - - @JsonProperty(ADDRESS) - protected AddressClaimSet address; - - @JsonProperty(UPDATED_AT) - protected Long updatedAt; - - @JsonProperty(CLAIMS_LOCALES) - protected String claimsLocales; - - @JsonProperty(ACR) - protected String acr; - - // Financial API - Part 2: Read and Write API Security Profile - // http://openid.net/specs/openid-financial-api-part-2.html#authorization-server - @JsonProperty(S_HASH) - protected String stateHash; - - public String getNonce() { - return nonce; - } - - public void setNonce(String nonce) { - this.nonce = nonce; - } - - public Long getAuth_time() { - return auth_time; - } - - public void setAuth_time(Long auth_time) { - this.auth_time = auth_time; - } - - public String getSessionId() { - return sessionId; - } - - public void setSessionId(String sessionId) { - this.sessionId = sessionId; - } - - /** - * @deprecated Use {@link #getSessionId()} instead. - */ - @Deprecated - @JsonIgnore - public String getSessionState() { - return getSessionId(); - } - - public String getAccessTokenHash() { - return accessTokenHash; - } - - public void setAccessTokenHash(String accessTokenHash) { - this.accessTokenHash = accessTokenHash; - } - - public String getCodeHash() { - return codeHash; - } - - public void setCodeHash(String codeHash) { - this.codeHash = codeHash; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - public String getGivenName() { - return this.givenName; - } - - public void setGivenName(String givenName) { - this.givenName = givenName; - } - - public String getFamilyName() { - return this.familyName; - } - - public void setFamilyName(String familyName) { - this.familyName = familyName; - } - - public String getMiddleName() { - return this.middleName; - } - - public void setMiddleName(String middleName) { - this.middleName = middleName; - } - - public String getNickName() { - return this.nickName; - } - - public void setNickName(String nickName) { - this.nickName = nickName; - } - - public String getPreferredUsername() { - return this.preferredUsername; - } - - public void setPreferredUsername(String preferredUsername) { - this.preferredUsername = preferredUsername; - } - - public String getProfile() { - return this.profile; - } - - public void setProfile(String profile) { - this.profile = profile; - } - - public String getPicture() { - return this.picture; - } - - public void setPicture(String picture) { - this.picture = picture; - } - - public String getWebsite() { - return this.website; - } - - public void setWebsite(String website) { - this.website = website; - } - - public String getEmail() { - return this.email; - } - - public void setEmail(String email) { - this.email = email; - } - - public Boolean getEmailVerified() { - return this.emailVerified; - } - - public void setEmailVerified(Boolean emailVerified) { - this.emailVerified = emailVerified; - } - - public String getGender() { - return this.gender; - } - - public void setGender(String gender) { - this.gender = gender; - } - - public String getBirthdate() { - return this.birthdate; - } - - public void setBirthdate(String birthdate) { - this.birthdate = birthdate; - } - - public String getZoneinfo() { - return this.zoneinfo; - } - - public void setZoneinfo(String zoneinfo) { - this.zoneinfo = zoneinfo; - } - - public String getLocale() { - return this.locale; - } - - public void setLocale(String locale) { - this.locale = locale; - } - - public String getPhoneNumber() { - return this.phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public Boolean getPhoneNumberVerified() { - return this.phoneNumberVerified; - } - - public void setPhoneNumberVerified(Boolean phoneNumberVerified) { - this.phoneNumberVerified = phoneNumberVerified; - } - - public AddressClaimSet getAddress() { - return address; - } - - public void setAddress(AddressClaimSet address) { - this.address = address; - } - - public Long getUpdatedAt() { - return this.updatedAt; - } - - public void setUpdatedAt(Long updatedAt) { - this.updatedAt = updatedAt; - } - - public String getClaimsLocales() { - return this.claimsLocales; - } - - public void setClaimsLocales(String claimsLocales) { - this.claimsLocales = claimsLocales; - } - - public String getAcr() { - return acr; - } - - public void setAcr(String acr) { - this.acr = acr; - } - - // Financial API - Part 2: Read and Write API Security Profile - // http://openid.net/specs/openid-financial-api-part-2.html#authorization-server - public String getStateHash() { - return stateHash; - } - - public void setStateHash(String stateHash) { - this.stateHash = stateHash; - } - - @Override - public TokenCategory getCategory() { - return TokenCategory.ID; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/JsonWebToken.java b/authz-client/src/main/java/org/keycloak/representations/JsonWebToken.java deleted file mode 100755 index a969273..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/JsonWebToken.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import org.keycloak.Token; -import org.keycloak.TokenCategory; -import org.keycloak.common.util.Time; -import org.keycloak.json.StringOrArrayDeserializer; -import org.keycloak.json.StringOrArraySerializer; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class JsonWebToken implements Serializable, Token { - public static final String AZP = "azp"; - public static final String SUBJECT = "sub"; - - @JsonProperty("jti") - protected String id; - - protected Long exp; - protected Long nbf; - protected Long iat; - - @JsonProperty("iss") - protected String issuer; - @JsonProperty("aud") - @JsonSerialize(using = StringOrArraySerializer.class) - @JsonDeserialize(using = StringOrArrayDeserializer.class) - protected String[] audience; - @JsonProperty(SUBJECT) - protected String subject; - @JsonProperty("typ") - protected String type; - @JsonProperty(AZP) - public String issuedFor; - protected Map otherClaims = new HashMap<>(); - - public String getId() { - return id; - } - - public JsonWebToken id(String id) { - this.id = id; - return this; - } - - public Long getExp() { - return exp; - } - - public JsonWebToken exp(Long exp) { - this.exp = exp; - return this; - } - - @JsonIgnore - public boolean isExpired() { - return exp != null && exp != 0 && Time.currentTime() > exp; - } - - public Long getNbf() { - return nbf; - } - - public JsonWebToken nbf(Long nbf) { - this.nbf = nbf; - return this; - } - - @JsonIgnore - public boolean isNotBefore(long allowedTimeSkew) { - return nbf == null || Time.currentTime() + allowedTimeSkew >= nbf; - } - - /** - * Tests that the token is not expired and is not-before. - * - * @return - */ - @JsonIgnore - public boolean isActive() { - return isActive(0); - } - - @JsonIgnore - public boolean isActive(int allowedTimeSkew) { - return !isExpired() && isNotBefore(allowedTimeSkew); - } - - /** - * @param sessionStarted Time in seconds - * @return true if the particular token was issued before the given session start time. Which means that token cannot be issued by the particular session - */ - @JsonIgnore - public boolean isIssuedBeforeSessionStart(long sessionStarted) { - return getIat() + 1 < sessionStarted; - } - - public Long getIat() { - return iat; - } - - /** - * Set issuedAt to the current time - */ - @JsonIgnore - public JsonWebToken issuedNow() { - iat = (long) Time.currentTime(); - return this; - } - - public JsonWebToken iat(Long iat) { - this.iat = iat; - return this; - } - - public String getIssuer() { - return issuer; - } - - public JsonWebToken issuer(String issuer) { - this.issuer = issuer; - return this; - } - - @JsonIgnore - public String[] getAudience() { - return audience; - } - - public boolean hasAudience(String audience) { - if (this.audience == null) return false; - for (String a : this.audience) { - if (a.equals(audience)) { - return true; - } - } - return false; - } - - public boolean hasAnyAudience(List audiences) { - String[] auds = getAudience(); - - if (auds == null) { - return false; - } - - for (String aud : auds) { - if (audiences.contains(aud)) { - return true; - } - } - - return false; - } - - public JsonWebToken audience(String... audience) { - this.audience = audience; - return this; - } - - public JsonWebToken addAudience(String audience) { - if (this.audience == null) { - this.audience = new String[] { audience }; - } else { - // Check if audience is already there - for (String aud : this.audience) { - if (audience.equals(aud)) { - return this; - } - } - - String[] newAudience = Arrays.copyOf(this.audience, this.audience.length + 1); - newAudience[this.audience.length] = audience; - this.audience = newAudience; - } - return this; - } - - public String getSubject() { - return subject; - } - - public JsonWebToken subject(String subject) { - this.subject = subject; - return this; - } - - public void setSubject(String subject) { - this.subject = subject; - } - - public String getType() { - return type; - } - - public JsonWebToken type(String type) { - this.type = type; - return this; - } - - /** - * OAuth client the token was issued for. - * - * @return - */ - public String getIssuedFor() { - return issuedFor; - } - - public JsonWebToken issuedFor(String issuedFor) { - this.issuedFor = issuedFor; - return this; - } - - /** - * This is a map of any other claims and data that might be in the IDToken. Could be custom claims set up by the auth server - * - * @return - */ - @JsonAnyGetter - public Map getOtherClaims() { - return otherClaims; - } - - @JsonAnySetter - public void setOtherClaims(String name, Object value) { - otherClaims.put(name, value); - } - - @Override - public TokenCategory getCategory() { - return TokenCategory.INTERNAL; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/KeyStoreConfig.java b/authz-client/src/main/java/org/keycloak/representations/KeyStoreConfig.java deleted file mode 100644 index 7826694..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/KeyStoreConfig.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors - * as indicated by the @author tags. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.keycloak.representations; - -/** - * Configuration of KeyStore. - * - * @author Stan Silvert ssilvert@redhat.com (C) 2016 Red Hat Inc. - */ -public class KeyStoreConfig { - - protected Boolean realmCertificate; - protected String storePassword; - protected String keyPassword; - protected String keyAlias; - protected String realmAlias; - protected String format; - - public Boolean isRealmCertificate() { - return realmCertificate; - } - - public void setRealmCertificate(Boolean realmCertificate) { - this.realmCertificate = realmCertificate; - } - - public String getStorePassword() { - return storePassword; - } - - public void setStorePassword(String storePassword) { - this.storePassword = storePassword; - } - - public String getKeyPassword() { - return keyPassword; - } - - public void setKeyPassword(String keyPassword) { - this.keyPassword = keyPassword; - } - - public String getKeyAlias() { - return keyAlias; - } - - public void setKeyAlias(String keyAlias) { - this.keyAlias = keyAlias; - } - - public String getRealmAlias() { - return realmAlias; - } - - public void setRealmAlias(String realmAlias) { - this.realmAlias = realmAlias; - } - - public String getFormat() { - return format; - } - - public void setFormat(String format) { - this.format = format; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/adapters/action/GlobalRequestResult.java b/authz-client/src/main/java/org/keycloak/representations/adapters/action/GlobalRequestResult.java deleted file mode 100644 index 688ae70..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/adapters/action/GlobalRequestResult.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.adapters.action; - -import java.util.ArrayList; -import java.util.List; - -/** - * Result of the "global" request (like push notBefore or logoutAll), which is send to all cluster nodes - * - * @author Marek Posolda - */ -public class GlobalRequestResult { - - private List successRequests; - private List failedRequests; - - public void addSuccessRequest(String reqUri) { - if (successRequests == null) { - successRequests = new ArrayList<>(); - } - successRequests.add(reqUri); - } - - public void addFailedRequest(String reqUri) { - if (failedRequests == null) { - failedRequests = new ArrayList<>(); - } - failedRequests.add(reqUri); - } - - public void addAllSuccessRequests(List reqUris) { - if (successRequests == null) { - successRequests = new ArrayList<>(); - } - successRequests.addAll(reqUris); - } - - public void addAllFailedRequests(List reqUris) { - if (failedRequests == null) { - failedRequests = new ArrayList<>(); - } - failedRequests.addAll(reqUris); - } - - public void addAll(GlobalRequestResult merged) { - if (merged.getSuccessRequests() != null && merged.getSuccessRequests().size() > 0) { - addAllSuccessRequests(merged.getSuccessRequests()); - } - if (merged.getFailedRequests() != null && merged.getFailedRequests().size() > 0) { - addAllFailedRequests(merged.getFailedRequests()); - } - } - - public List getSuccessRequests() { - return successRequests; - } - - public List getFailedRequests() { - return failedRequests; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/AbstractAuthenticationExecutionRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/AbstractAuthenticationExecutionRepresentation.java deleted file mode 100644 index 9bc0c99..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/AbstractAuthenticationExecutionRepresentation.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.io.Serializable; - -/** - * @author Marko Strukelj - */ -public class AbstractAuthenticationExecutionRepresentation implements Serializable { - - private String authenticatorConfig; - private String authenticator; - private boolean authenticatorFlow; - private String requirement; - private Integer priority; - - public String getAuthenticatorConfig() { - return authenticatorConfig; - } - - public void setAuthenticatorConfig(String authenticatorConfig) { - this.authenticatorConfig = authenticatorConfig; - } - - public String getAuthenticator() { - return authenticator; - } - - public void setAuthenticator(String authenticator) { - this.authenticator = authenticator; - } - - public String getRequirement() { - return requirement; - } - - public void setRequirement(String requirement) { - this.requirement = requirement; - } - - public Integer getPriority() { - return priority; - } - - public void setPriority(Integer priority) { - this.priority = priority; - } - - /** - * Is the referenced authenticator a flow? - * - * @return - */ - @Deprecated - private boolean autheticatorFlow; - - @Deprecated - public boolean isAutheticatorFlow() { - return authenticatorFlow; - } - - @Deprecated - public void setAutheticatorFlow(boolean autheticatorFlow) { - this.authenticatorFlow = autheticatorFlow; - } - - /** - * Is the referenced authenticator a flow? - * - * @return - */ - public boolean isAuthenticatorFlow() { - return authenticatorFlow; - } - - public void setAuthenticatorFlow(boolean authenticatorFlow) { - this.authenticatorFlow = authenticatorFlow; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/AbstractUserRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/AbstractUserRepresentation.java deleted file mode 100644 index c4fe9cb..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/AbstractUserRepresentation.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2023 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import org.keycloak.json.StringListMapDeserializer; - -public abstract class AbstractUserRepresentation { - - public static String USERNAME = "username"; - public static String FIRST_NAME = "firstName"; - public static String LAST_NAME = "lastName"; - public static String EMAIL = "email"; - public static String LOCALE = "locale"; - - protected String id; - protected String username; - protected String firstName; - protected String lastName; - protected String email; - protected Boolean emailVerified; - @JsonDeserialize(using = StringListMapDeserializer.class) - protected Map> attributes; - private UserProfileMetadata userProfileMetadata; - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public Boolean isEmailVerified() { - return emailVerified; - } - - public void setEmailVerified(Boolean emailVerified) { - this.emailVerified = emailVerified; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - /** - * Returns all the attributes set to this user except the root attributes. - * - * @return the user attributes. - */ - public Map> getAttributes() { - return attributes; - } - - /** - * Returns all the user attributes including the root attributes. - * - * @return all the user attributes. - */ - @JsonIgnore - public Map> getRawAttributes() { - Map> attrs = new HashMap<>(Optional.ofNullable(attributes).orElse(new HashMap<>())); - - if (username != null) - attrs.put(USERNAME, Collections.singletonList(getUsername())); - else - attrs.remove(USERNAME); - - if (email != null) - attrs.put(EMAIL, Collections.singletonList(getEmail())); - else - attrs.remove(EMAIL); - - if (lastName != null) - attrs.put(LAST_NAME, Collections.singletonList(getLastName())); - - if (firstName != null) - attrs.put(FIRST_NAME, Collections.singletonList(getFirstName())); - - return attrs; - } - - public void setAttributes(Map> attributes) { - this.attributes = attributes; - } - - @SuppressWarnings("unchecked") - public R singleAttribute(String name, String value) { - if (this.attributes == null) this.attributes=new HashMap<>(); - attributes.put(name, (value == null ? Collections.emptyList() : Arrays.asList(value))); - return (R) this; - } - - public String firstAttribute(String key) { - return this.attributes == null ? null : this.attributes.get(key) == null ? null : this.attributes.get(key).isEmpty()? null : this.attributes.get(key).get(0); - } - - public void setUserProfileMetadata(UserProfileMetadata userProfileMetadata) { - this.userProfileMetadata = userProfileMetadata; - } - - public UserProfileMetadata getUserProfileMetadata() { - return userProfileMetadata; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/AdminEventRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/AdminEventRepresentation.java deleted file mode 100644 index 9aa1e16..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/AdminEventRepresentation.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors - * as indicated by the @author tags. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package org.keycloak.representations.idm; - -/** - * @author Stan Silvert ssilvert@redhat.com (C) 2016 Red Hat Inc. - */ -public class AdminEventRepresentation { - - private long time; - private String realmId; - private AuthDetailsRepresentation authDetails; - private String operationType; - private String resourceType; - private String resourcePath; - private String representation; - private String error; - - public long getTime() { - return time; - } - - public void setTime(long time) { - this.time = time; - } - - public String getRealmId() { - return realmId; - } - - public void setRealmId(String realmId) { - this.realmId = realmId; - } - - public AuthDetailsRepresentation getAuthDetails() { - return authDetails; - } - - public void setAuthDetails(AuthDetailsRepresentation authDetails) { - this.authDetails = authDetails; - } - - public String getOperationType() { - return operationType; - } - - public void setOperationType(String operationType) { - this.operationType = operationType; - } - - public String getResourceType() { - return resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public String getResourcePath() { - return resourcePath; - } - - public void setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; - } - - public String getRepresentation() { - return representation; - } - - public void setRepresentation(String representation) { - this.representation = representation; - } - - public String getError() { - return error; - } - - public void setError(String error) { - this.error = error; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ApplicationRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ApplicationRepresentation.java deleted file mode 100755 index bdff0d8..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ApplicationRepresentation.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -@Deprecated -public class ApplicationRepresentation extends ClientRepresentation { - protected String name; - @Deprecated - protected ClaimRepresentation claims; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public ClaimRepresentation getClaims() { - return claims; - } - - public void setClaims(ClaimRepresentation claims) { - this.claims = claims; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/AuthDetailsRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/AuthDetailsRepresentation.java deleted file mode 100644 index 746aa71..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/AuthDetailsRepresentation.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors - * as indicated by the @author tags. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package org.keycloak.representations.idm; - -/** - * - * @author Stan Silvert ssilvert@redhat.com (C) 2016 Red Hat Inc. - */ -public class AuthDetailsRepresentation { - - private String realmId; - private String clientId; - private String userId; - private String ipAddress; - - public String getRealmId() { - return realmId; - } - - public void setRealmId(String realmId) { - this.realmId = realmId; - } - - public String getClientId() { - return clientId; - } - - public void setClientId(String clientId) { - this.clientId = clientId; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getIpAddress() { - return ipAddress; - } - - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionExportRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionExportRepresentation.java deleted file mode 100755 index 74a8358..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionExportRepresentation.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** -* @author Bill Burke -* @version $Revision: 1 $ -*/ -public class AuthenticationExecutionExportRepresentation extends AbstractAuthenticationExecutionRepresentation { - - private String flowAlias; - private boolean userSetupAllowed; - - - public boolean isUserSetupAllowed() { - return userSetupAllowed; - } - - public void setUserSetupAllowed(boolean userSetupAllowed) { - this.userSetupAllowed = userSetupAllowed; - } - - /** - * If this execution is a flow, this is the flowId pointing to an AuthenticationFlowModel - * - * @return - */ - public String getFlowAlias() { - return flowAlias; - } - - public void setFlowAlias(String flowId) { - this.flowAlias = flowId; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionInfoRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionInfoRepresentation.java deleted file mode 100755 index 9ed381c..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionInfoRepresentation.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.io.Serializable; -import java.util.List; - -/** -* @author Bill Burke -* @version $Revision: 1 $ -*/ -public class AuthenticationExecutionInfoRepresentation implements Serializable { - - protected String id; - protected String requirement; - protected String displayName; - protected String alias; - protected String description; - protected List requirementChoices; - protected Boolean configurable; - protected Boolean authenticationFlow; - protected String providerId; - protected String authenticationConfig; - protected String flowId; - protected int level; - protected int index; - protected int priority; - - public String getId() { - return id; - } - - public void setId(String execution) { - this.id = execution; - } - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public String getAlias() { - return alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getRequirement() { - return requirement; - } - - public void setRequirement(String requirement) { - this.requirement = requirement; - } - - public List getRequirementChoices() { - return requirementChoices; - } - - public void setRequirementChoices(List requirementChoices) { - this.requirementChoices = requirementChoices; - } - - public Boolean getConfigurable() { - return configurable; - } - - public void setConfigurable(Boolean configurable) { - this.configurable = configurable; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public String getAuthenticationConfig() { - return authenticationConfig; - } - - public void setAuthenticationConfig(String authenticationConfig) { - this.authenticationConfig = authenticationConfig; - } - - public Boolean getAuthenticationFlow() { - return authenticationFlow; - } - - public void setAuthenticationFlow(Boolean authenticationFlow) { - this.authenticationFlow = authenticationFlow; - } - - public int getLevel() { - return level; - } - - public void setLevel(int level) { - this.level = level; - } - - public int getIndex() { - return index; - } - - public void setIndex(int index) { - this.index = index; - } - - public String getFlowId() { - return flowId; - } - - public void setFlowId(String flowId) { - this.flowId = flowId; - } - - public int getPriority() { - return priority; - } - - public void setPriority(int priority) { - this.priority = priority; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionRepresentation.java deleted file mode 100644 index 532166c..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionRepresentation.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * @author Marko Strukelj - */ -public class AuthenticationExecutionRepresentation extends AbstractAuthenticationExecutionRepresentation { - - private String id; - private String flowId; - private String parentFlow; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getFlowId() { - return flowId; - } - - public void setFlowId(String flowId) { - this.flowId = flowId; - } - - public String getParentFlow() { - return parentFlow; - } - - public void setParentFlow(String parentFlow) { - this.parentFlow = parentFlow; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticationFlowRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticationFlowRepresentation.java deleted file mode 100755 index ee58fc4..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticationFlowRepresentation.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.io.Serializable; -import java.util.List; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class AuthenticationFlowRepresentation implements Serializable { - - private String id; - private String alias; - private String description; - private String providerId; - private boolean topLevel; - private boolean builtIn; - protected List authenticationExecutions; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getAlias() { - return alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public boolean isTopLevel() { - return topLevel; - } - - public void setTopLevel(boolean topLevel) { - this.topLevel = topLevel; - } - - public boolean isBuiltIn() { - return builtIn; - } - - public void setBuiltIn(boolean builtIn) { - this.builtIn = builtIn; - } - - public List getAuthenticationExecutions() { - return authenticationExecutions; - } - - public void setAuthenticationExecutions(List authenticationExecutions) { - this.authenticationExecutions = authenticationExecutions; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticatorConfigInfoRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticatorConfigInfoRepresentation.java deleted file mode 100644 index a26998b..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticatorConfigInfoRepresentation.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; - -/** - * @author Marko Strukelj - */ -public class AuthenticatorConfigInfoRepresentation { - - protected String name; - protected String providerId; - protected String helpText; - - protected List properties; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getHelpText() { - return helpText; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public void setHelpText(String helpText) { - this.helpText = helpText; - } - - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } -} - diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticatorConfigRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticatorConfigRepresentation.java deleted file mode 100755 index 5db7278..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/AuthenticatorConfigRepresentation.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -/** -* @author Bill Burke -* @version $Revision: 1 $ -*/ -public class AuthenticatorConfigRepresentation implements Serializable { - - private String id; - private String alias; - private Map config = new HashMap<>(); - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getAlias() { - return alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } - - public Map getConfig() { - return config; - } - - public void setConfig(Map config) { - this.config = config; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/CertificateRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/CertificateRepresentation.java deleted file mode 100755 index d10616c..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/CertificateRepresentation.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * PEM values of key and certificate - * - * @author Marek Posolda - */ -public class CertificateRepresentation { - - protected String privateKey; - protected String publicKey; - protected String certificate; - protected String kid; - - public String getPrivateKey() { - return privateKey; - } - - public void setPrivateKey(String privateKey) { - this.privateKey = privateKey; - } - - public String getPublicKey() { - return publicKey; - } - - public void setPublicKey(String publicKey) { - this.publicKey = publicKey; - } - - public String getCertificate() { - return certificate; - } - - public void setCertificate(String certificate) { - this.certificate = certificate; - } - - public String getKid() { - return kid; - } - - public void setKid(String kid) { - this.kid = kid; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClaimRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClaimRepresentation.java deleted file mode 100755 index 432ca4e..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClaimRepresentation.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class ClaimRepresentation { - protected boolean name; - protected boolean username; - protected boolean profile; - protected boolean picture; - protected boolean website; - protected boolean email; - protected boolean gender; - protected boolean locale; - protected boolean address; - protected boolean phone; - - public boolean getName() { - return name; - } - - public void setName(boolean name) { - this.name = name; - } - - public boolean getUsername() { - return username; - } - - public void setUsername(boolean username) { - this.username = username; - } - - public boolean getProfile() { - return profile; - } - - public void setProfile(boolean profile) { - this.profile = profile; - } - - public boolean getPicture() { - return picture; - } - - public void setPicture(boolean picture) { - this.picture = picture; - } - - public boolean getWebsite() { - return website; - } - - public void setWebsite(boolean website) { - this.website = website; - } - - public boolean getEmail() { - return email; - } - - public void setEmail(boolean email) { - this.email = email; - } - - public boolean getGender() { - return gender; - } - - public void setGender(boolean gender) { - this.gender = gender; - } - - public boolean getLocale() { - return locale; - } - - public void setLocale(boolean locale) { - this.locale = locale; - } - - public boolean getAddress() { - return address; - } - - public void setAddress(boolean address) { - this.address = address; - } - - public boolean getPhone() { - return phone; - } - - public void setPhone(boolean phone) { - this.phone = phone; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ClaimRepresentation that = (ClaimRepresentation) o; - - if (address != that.address) return false; - if (email != that.email) return false; - if (gender != that.gender) return false; - if (locale != that.locale) return false; - if (name != that.name) return false; - if (phone != that.phone) return false; - if (picture != that.picture) return false; - if (profile != that.profile) return false; - if (username != that.username) return false; - if (website != that.website) return false; - - return true; - } - - @Override - public int hashCode() { - int result = (name ? 1 : 0); - result = 31 * result + (username ? 1 : 0); - result = 31 * result + (profile ? 1 : 0); - result = 31 * result + (picture ? 1 : 0); - result = 31 * result + (website ? 1 : 0); - result = 31 * result + (email ? 1 : 0); - result = 31 * result + (gender ? 1 : 0); - result = 31 * result + (locale ? 1 : 0); - result = 31 * result + (address ? 1 : 0); - result = 31 * result + (phone ? 1 : 0); - return result; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientInitialAccessCreatePresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientInitialAccessCreatePresentation.java deleted file mode 100644 index 27064ec..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientInitialAccessCreatePresentation.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * @author Stian Thorgersen - */ -public class ClientInitialAccessCreatePresentation { - - private Integer expiration; - - private Integer count; - - public ClientInitialAccessCreatePresentation() { - } - - public ClientInitialAccessCreatePresentation(Integer expiration, Integer count) { - this.expiration = expiration; - this.count = count; - } - - public Integer getExpiration() { - return expiration; - } - - public void setExpiration(Integer expiration) { - this.expiration = expiration; - } - - public Integer getCount() { - return count; - } - - public void setCount(Integer count) { - this.count = count; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientInitialAccessPresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientInitialAccessPresentation.java deleted file mode 100644 index ce52ba9..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientInitialAccessPresentation.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * @author Stian Thorgersen - */ -public class ClientInitialAccessPresentation { - - private String id; - - private String token; - - private Integer timestamp; - - private Integer expiration; - - private Integer count; - - private Integer remainingCount; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - public Integer getTimestamp() { - return timestamp; - } - - public void setTimestamp(Integer timestamp) { - this.timestamp = timestamp; - } - - public Integer getExpiration() { - return expiration; - } - - public void setExpiration(Integer expiration) { - this.expiration = expiration; - } - - public Integer getCount() { - return count; - } - - public void setCount(Integer count) { - this.count = count; - } - - public Integer getRemainingCount() { - return remainingCount; - } - - public void setRemainingCount(Integer remainingCount) { - this.remainingCount = remainingCount; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientMappingsRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientMappingsRepresentation.java deleted file mode 100755 index 64cc759..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientMappingsRepresentation.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class ClientMappingsRepresentation { - protected String id; - protected String client; - - protected List mappings; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getClient() { - return client; - } - - public void setClient(String client) { - this.client = client; - } - - public List getMappings() { - return mappings; - } - - public void setMappings(List mappings) { - this.mappings = mappings; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientPoliciesRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientPoliciesRepresentation.java deleted file mode 100644 index f2a076c..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientPoliciesRepresentation.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.databind.JsonNode; -import org.keycloak.util.JsonSerialization; - -/** - * Client Policies' (the set of all Client Policy) external representation class - * - * @author Takashi Norimatsu - */ -public class ClientPoliciesRepresentation { - protected List policies = new ArrayList<>(); - private List globalPolicies; - - public List getPolicies() { - return policies; - } - - public void setPolicies(List policies) { - this.policies = policies; - } - - public List getGlobalPolicies() { - return globalPolicies; - } - - public void setGlobalPolicies(List globalPolicies) { - this.globalPolicies = globalPolicies; - } - - @Override - public int hashCode() { - return JsonSerialization.mapper.convertValue(this, JsonNode.class).hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof ClientPoliciesRepresentation)) return false; - JsonNode jsonNode = JsonSerialization.mapper.convertValue(this, JsonNode.class); - JsonNode jsonNodeThat = JsonSerialization.mapper.convertValue(obj, JsonNode.class); - return jsonNode.equals(jsonNodeThat); - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionConfigurationRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionConfigurationRepresentation.java deleted file mode 100644 index c998177..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionConfigurationRepresentation.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.keycloak.representations.idm; - -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Just adds some type-safety to the ClientPolicyConditionConfiguration - * - * @author Takashi Norimatsu - */ -public class ClientPolicyConditionConfigurationRepresentation { - - private Map configAsMap = new HashMap<>(); - - @JsonProperty("is-negative-logic") - private Boolean negativeLogic; - - public Boolean isNegativeLogic() { - return negativeLogic; - } - - public void setNegativeLogic(Boolean negativeLogic) { - this.negativeLogic = negativeLogic; - } - - @JsonAnyGetter - public Map getConfigAsMap() { - return configAsMap; - } - - @JsonAnySetter - public void setConfigAsMap(String name, Object value) { - this.configAsMap.put(name, value); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionRepresentation.java deleted file mode 100644 index 9e77158..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionRepresentation.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.keycloak.representations.idm; - -import java.util.Objects; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -/** - * @author Marek Posolda - */ -public class ClientPolicyConditionRepresentation { - - @JsonProperty("condition") - private String conditionProviderId; - - @JsonProperty("configuration") - private JsonNode configuration; - - public String getConditionProviderId() { - return conditionProviderId; - } - - public void setConditionProviderId(String conditionProviderId) { - this.conditionProviderId = conditionProviderId; - } - - public JsonNode getConfiguration() { - return configuration; - } - - public void setConfiguration(JsonNode configuration) { - this.configuration = configuration; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ClientPolicyConditionRepresentation that = (ClientPolicyConditionRepresentation) o; - return Objects.equals(conditionProviderId, that.conditionProviderId) && Objects.equals(configuration, that.configuration); - } - - @Override - public int hashCode() { - return Objects.hash(conditionProviderId, configuration); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorConfigurationRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorConfigurationRepresentation.java deleted file mode 100644 index 46bcd8e..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorConfigurationRepresentation.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.keycloak.representations.idm; - -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; - -/** - * Just adds some type-safety to the ClientPolicyExecutorConfiguration - * - * @author Marek Posolda - */ -public class ClientPolicyExecutorConfigurationRepresentation { - - private Map configAsMap = new HashMap<>(); - - @JsonAnyGetter - public Map getConfigAsMap() { - return configAsMap; - } - - @JsonAnySetter - public void setConfigAsMap(String name, Object value) { - this.configAsMap.put(name, value); - } - - public boolean validateConfig(){ - return true; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorRepresentation.java deleted file mode 100644 index a0c2a3f..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorRepresentation.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.keycloak.representations.idm; - -import java.util.Objects; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -/** - * @author Marek Posolda - */ -public class ClientPolicyExecutorRepresentation { - - @JsonProperty("executor") - private String executorProviderId; - - @JsonProperty("configuration") - private JsonNode configuration; - - public String getExecutorProviderId() { - return executorProviderId; - } - - public void setExecutorProviderId(String providerId) { - this.executorProviderId = providerId; - } - - public JsonNode getConfiguration() { - return configuration; - } - - public void setConfiguration(JsonNode configuration) { - this.configuration = configuration; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ClientPolicyExecutorRepresentation that = (ClientPolicyExecutorRepresentation) o; - return Objects.equals(executorProviderId, that.executorProviderId) && Objects.equals(configuration, that.configuration); - } - - @Override - public int hashCode() { - return Objects.hash(executorProviderId, configuration); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyRepresentation.java deleted file mode 100644 index c34e795..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientPolicyRepresentation.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; -import java.util.Objects; - -/** - * Client Policy's external representation class - * - * @author Takashi Norimatsu - */ -public class ClientPolicyRepresentation { - - protected String name; - protected String description; - protected Boolean enabled; - protected List conditions; - protected List profiles; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Boolean isEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - public List getConditions() { - return conditions; - } - - public void setConditions(List conditions) { - this.conditions = conditions; - } - - public List getProfiles() { - return profiles; - } - - public void setProfiles(List profiles) { - this.profiles = profiles; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ClientPolicyRepresentation that = (ClientPolicyRepresentation) o; - return Objects.equals(name, that.name) && Objects.equals(description, that.description) && Objects.equals(enabled, that.enabled) && Objects.equals(conditions, that.conditions) && Objects.equals(profiles, that.profiles); - } - - @Override - public int hashCode() { - return Objects.hash(name, description, enabled, conditions, profiles); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientProfileRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientProfileRepresentation.java deleted file mode 100644 index ac95e01..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientProfileRepresentation.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; -import java.util.Objects; - -/** - * Client Profile's external representation class - * - * @author Takashi Norimatsu - */ -public class ClientProfileRepresentation { - - protected String name; - protected String description; - protected List executors; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public List getExecutors() { - return executors; - } - - public void setExecutors(List executors) { - this.executors = executors; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ClientProfileRepresentation that = (ClientProfileRepresentation) o; - return Objects.equals(name, that.name) && Objects.equals(description, that.description) && Objects.equals(executors, that.executors); - } - - @Override - public int hashCode() { - return Objects.hash(name, description, executors); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientProfilesRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientProfilesRepresentation.java deleted file mode 100644 index f326181..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientProfilesRepresentation.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import org.keycloak.util.JsonSerialization; - -/** - * Client Profiles' (the set of all Client Profile) external representation class - * - * @author Takashi Norimatsu - */ -public class ClientProfilesRepresentation { - - private List profiles = new ArrayList<>(); - - // Global profiles, which are builtin in Keycloak. - @JsonProperty("globalProfiles") - private List globalProfiles; - - public List getProfiles() { - return profiles; - } - - public void setProfiles(List profiles) { - this.profiles = profiles; - } - - public List getGlobalProfiles() { - return globalProfiles; - } - - public void setGlobalProfiles(List globalProfiles) { - this.globalProfiles = globalProfiles; - } - - @Override - public int hashCode() { - return JsonSerialization.mapper.convertValue(this, JsonNode.class).hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof ClientProfilesRepresentation)) return false; - JsonNode jsonNode = JsonSerialization.mapper.convertValue(this, JsonNode.class); - JsonNode jsonNodeThat = JsonSerialization.mapper.convertValue(obj, JsonNode.class); - return jsonNode.equals(jsonNodeThat); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientRepresentation.java deleted file mode 100755 index 5aca876..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientRepresentation.java +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import org.keycloak.representations.idm.authorization.ResourceServerRepresentation; - -import java.util.List; -import java.util.Map; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class ClientRepresentation { - protected String id; - protected String clientId; - protected String name; - protected String description; - protected String type; - protected String rootUrl; - protected String adminUrl; - protected String baseUrl; - protected Boolean surrogateAuthRequired; - protected Boolean enabled; - protected Boolean alwaysDisplayInConsole; - protected String clientAuthenticatorType; - protected String secret; - protected String registrationAccessToken; - @Deprecated - protected String[] defaultRoles; - protected List redirectUris; - protected List webOrigins; - protected Integer notBefore; - protected Boolean bearerOnly; - protected Boolean consentRequired; - protected Boolean standardFlowEnabled; - protected Boolean implicitFlowEnabled; - protected Boolean directAccessGrantsEnabled; - protected Boolean serviceAccountsEnabled; - protected Boolean authorizationServicesEnabled; - @Deprecated - protected Boolean directGrantsOnly; - protected Boolean publicClient; - protected Boolean frontchannelLogout; - protected String protocol; - protected Map attributes; - protected Map authenticationFlowBindingOverrides; - protected Boolean fullScopeAllowed; - protected Integer nodeReRegistrationTimeout; - protected Map registeredNodes; - protected List protocolMappers; - - @Deprecated - protected String clientTemplate; - @Deprecated - private Boolean useTemplateConfig; - @Deprecated - private Boolean useTemplateScope; - @Deprecated - private Boolean useTemplateMappers; - - protected List defaultClientScopes; - protected List optionalClientScopes; - - private ResourceServerRepresentation authorizationSettings; - private Map access; - protected String origin; - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getClientId() { - return clientId; - } - - public void setClientId(String clientId) { - this.clientId = clientId; - } - - public Boolean isEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - public Boolean isAlwaysDisplayInConsole() { - return alwaysDisplayInConsole; - } - - public void setAlwaysDisplayInConsole(Boolean alwaysDisplayInConsole) { - this.alwaysDisplayInConsole = alwaysDisplayInConsole; - } - - public Boolean isSurrogateAuthRequired() { - return surrogateAuthRequired; - } - - public void setSurrogateAuthRequired(Boolean surrogateAuthRequired) { - this.surrogateAuthRequired = surrogateAuthRequired; - } - - public String getRootUrl() { - return rootUrl; - } - - public void setRootUrl(String rootUrl) { - this.rootUrl = rootUrl; - } - - public String getAdminUrl() { - return adminUrl; - } - - public void setAdminUrl(String adminUrl) { - this.adminUrl = adminUrl; - } - - public String getBaseUrl() { - return baseUrl; - } - - public void setBaseUrl(String baseUrl) { - this.baseUrl = baseUrl; - } - - public String getClientAuthenticatorType() { - return clientAuthenticatorType; - } - - public void setClientAuthenticatorType(String clientAuthenticatorType) { - this.clientAuthenticatorType = clientAuthenticatorType; - } - - public String getSecret() { - return secret; - } - - public void setSecret(String secret) { - this.secret = secret; - } - - public String getRegistrationAccessToken() { - return registrationAccessToken; - } - - public void setRegistrationAccessToken(String registrationAccessToken) { - this.registrationAccessToken = registrationAccessToken; - } - - public List getRedirectUris() { - return redirectUris; - } - - public void setRedirectUris(List redirectUris) { - this.redirectUris = redirectUris; - } - - public List getWebOrigins() { - return webOrigins; - } - - public void setWebOrigins(List webOrigins) { - this.webOrigins = webOrigins; - } - - @Deprecated - public String[] getDefaultRoles() { - return defaultRoles; - } - - @Deprecated - public void setDefaultRoles(String[] defaultRoles) { - this.defaultRoles = defaultRoles; - } - - public Integer getNotBefore() { - return notBefore; - } - - public void setNotBefore(Integer notBefore) { - this.notBefore = notBefore; - } - - public Boolean isBearerOnly() { - return bearerOnly; - } - - public void setBearerOnly(Boolean bearerOnly) { - this.bearerOnly = bearerOnly; - } - - public Boolean isConsentRequired() { - return consentRequired; - } - - public void setConsentRequired(Boolean consentRequired) { - this.consentRequired = consentRequired; - } - - public Boolean isStandardFlowEnabled() { - return standardFlowEnabled; - } - - public void setStandardFlowEnabled(Boolean standardFlowEnabled) { - this.standardFlowEnabled = standardFlowEnabled; - } - - public Boolean isImplicitFlowEnabled() { - return implicitFlowEnabled; - } - - public void setImplicitFlowEnabled(Boolean implicitFlowEnabled) { - this.implicitFlowEnabled = implicitFlowEnabled; - } - - public Boolean isDirectAccessGrantsEnabled() { - return directAccessGrantsEnabled; - } - - public void setDirectAccessGrantsEnabled(Boolean directAccessGrantsEnabled) { - this.directAccessGrantsEnabled = directAccessGrantsEnabled; - } - - public Boolean isServiceAccountsEnabled() { - return serviceAccountsEnabled; - } - - public void setServiceAccountsEnabled(Boolean serviceAccountsEnabled) { - this.serviceAccountsEnabled = serviceAccountsEnabled; - } - - public Boolean getAuthorizationServicesEnabled() { - if (authorizationSettings != null) { - return true; - } - return authorizationServicesEnabled; - } - - public void setAuthorizationServicesEnabled(Boolean authorizationServicesEnabled) { - this.authorizationServicesEnabled = authorizationServicesEnabled; - } - - @Deprecated - public Boolean isDirectGrantsOnly() { - return directGrantsOnly; - } - - public void setDirectGrantsOnly(Boolean directGrantsOnly) { - this.directGrantsOnly = directGrantsOnly; - } - - public Boolean isPublicClient() { - return publicClient; - } - - public void setPublicClient(Boolean publicClient) { - this.publicClient = publicClient; - } - - public Boolean isFullScopeAllowed() { - return fullScopeAllowed; - } - - public void setFullScopeAllowed(Boolean fullScopeAllowed) { - this.fullScopeAllowed = fullScopeAllowed; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public Map getAttributes() { - return attributes; - } - - public void setAttributes(Map attributes) { - this.attributes = attributes; - } - - public Map getAuthenticationFlowBindingOverrides() { - return authenticationFlowBindingOverrides; - } - - public void setAuthenticationFlowBindingOverrides(Map authenticationFlowBindingOverrides) { - this.authenticationFlowBindingOverrides = authenticationFlowBindingOverrides; - } - - public Integer getNodeReRegistrationTimeout() { - return nodeReRegistrationTimeout; - } - - public void setNodeReRegistrationTimeout(Integer nodeReRegistrationTimeout) { - this.nodeReRegistrationTimeout = nodeReRegistrationTimeout; - } - - public Map getRegisteredNodes() { - return registeredNodes; - } - - public void setRegisteredNodes(Map registeredNodes) { - this.registeredNodes = registeredNodes; - } - - public Boolean isFrontchannelLogout() { - return frontchannelLogout; - } - - public void setFrontchannelLogout(Boolean frontchannelLogout) { - this.frontchannelLogout = frontchannelLogout; - } - - public List getProtocolMappers() { - return protocolMappers; - } - - public void setProtocolMappers(List protocolMappers) { - this.protocolMappers = protocolMappers; - } - - @Deprecated - public String getClientTemplate() { - return clientTemplate; - } - - @Deprecated - public Boolean isUseTemplateConfig() { - return useTemplateConfig; - } - - @Deprecated - public Boolean isUseTemplateScope() { - return useTemplateScope; - } - - @Deprecated - public Boolean isUseTemplateMappers() { - return useTemplateMappers; - } - - public List getDefaultClientScopes() { - return defaultClientScopes; - } - - public void setDefaultClientScopes(List defaultClientScopes) { - this.defaultClientScopes = defaultClientScopes; - } - - public List getOptionalClientScopes() { - return optionalClientScopes; - } - - public void setOptionalClientScopes(List optionalClientScopes) { - this.optionalClientScopes = optionalClientScopes; - } - - public ResourceServerRepresentation getAuthorizationSettings() { - return authorizationSettings; - } - - public void setAuthorizationSettings(ResourceServerRepresentation authorizationSettings) { - this.authorizationSettings = authorizationSettings; - } - - public Map getAccess() { - return access; - } - - public void setAccess(Map access) { - this.access = access; - } - - - /** - * Returns id of ClientStorageProvider that loaded this user - * - * @return NULL if user stored locally - */ - public String getOrigin() { - return origin; - } - - public void setOrigin(String origin) { - this.origin = origin; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientScopeRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientScopeRepresentation.java deleted file mode 100755 index 0f7fd58..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientScopeRepresentation.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -/** - * @author Marek Posolda - */ -@JsonIgnoreProperties(ignoreUnknown=true) // Backwards compatibility of admin REST endpoints (ClientTemplateRepresentation was more rich) -public class ClientScopeRepresentation { - - protected String id; - protected String name; - protected String description; - protected String protocol; - protected Map attributes; - - protected List protocolMappers; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - - public List getProtocolMappers() { - return protocolMappers; - } - - public void setProtocolMappers(List protocolMappers) { - this.protocolMappers = protocolMappers; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public Map getAttributes() { - return attributes; - } - - public void setAttributes(Map attributes) { - this.attributes = attributes; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || !(o instanceof ClientScopeRepresentation)) return false; - - ClientScopeRepresentation that = (ClientScopeRepresentation) o; - return that.getId().equals(getId()); - } - - @Override - public int hashCode() { - return getId().hashCode(); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientTemplateRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientTemplateRepresentation.java deleted file mode 100755 index 3ad7cc4..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientTemplateRepresentation.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; -import java.util.Map; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -@Deprecated // Use ClientScopeRepresentation instead -public class ClientTemplateRepresentation { - /** - * Use this value in ClientRepresentation.setClientTemplate when you want to clear this value - */ - public static final String NONE = "NONE"; - protected String id; - protected String name; - protected String description; - protected String protocol; - protected Boolean fullScopeAllowed; - protected Boolean bearerOnly; - protected Boolean consentRequired; - protected Boolean standardFlowEnabled; - protected Boolean implicitFlowEnabled; - protected Boolean directAccessGrantsEnabled; - protected Boolean serviceAccountsEnabled; - protected Boolean publicClient; - protected Boolean frontchannelLogout; - protected Map attributes; - - protected List protocolMappers; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - - public List getProtocolMappers() { - return protocolMappers; - } - - public void setProtocolMappers(List protocolMappers) { - this.protocolMappers = protocolMappers; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public Boolean isFullScopeAllowed() { - return fullScopeAllowed; - } - - public void setFullScopeAllowed(Boolean fullScopeAllowed) { - this.fullScopeAllowed = fullScopeAllowed; - } - - public Boolean isBearerOnly() { - return bearerOnly; - } - - public void setBearerOnly(Boolean bearerOnly) { - this.bearerOnly = bearerOnly; - } - - public Boolean isConsentRequired() { - return consentRequired; - } - - public void setConsentRequired(Boolean consentRequired) { - this.consentRequired = consentRequired; - } - - public Boolean isStandardFlowEnabled() { - return standardFlowEnabled; - } - - public void setStandardFlowEnabled(Boolean standardFlowEnabled) { - this.standardFlowEnabled = standardFlowEnabled; - } - - public Boolean isImplicitFlowEnabled() { - return implicitFlowEnabled; - } - - public void setImplicitFlowEnabled(Boolean implicitFlowEnabled) { - this.implicitFlowEnabled = implicitFlowEnabled; - } - - public Boolean isDirectAccessGrantsEnabled() { - return directAccessGrantsEnabled; - } - - public void setDirectAccessGrantsEnabled(Boolean directAccessGrantsEnabled) { - this.directAccessGrantsEnabled = directAccessGrantsEnabled; - } - - public Boolean isServiceAccountsEnabled() { - return serviceAccountsEnabled; - } - - public void setServiceAccountsEnabled(Boolean serviceAccountsEnabled) { - this.serviceAccountsEnabled = serviceAccountsEnabled; - } - - public Boolean isPublicClient() { - return publicClient; - } - - public void setPublicClient(Boolean publicClient) { - this.publicClient = publicClient; - } - - public Boolean isFrontchannelLogout() { - return frontchannelLogout; - } - - public void setFrontchannelLogout(Boolean frontchannelLogout) { - this.frontchannelLogout = frontchannelLogout; - } - - public Map getAttributes() { - return attributes; - } - - public void setAttributes(Map attributes) { - this.attributes = attributes; - } -} - diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientTypeRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientTypeRepresentation.java deleted file mode 100644 index 8170118..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientTypeRepresentation.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.keycloak.representations.idm; - -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * @author Marek Posolda - */ -public class ClientTypeRepresentation { - - @JsonProperty("name") - private String name; - - @JsonProperty("provider") - private String provider; - - @JsonProperty("parent") - private String parent; - - @JsonProperty("config") - private Map config; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getProvider() { - return provider; - } - - public void setProvider(String provider) { - this.provider = provider; - } - - public Map getConfig() { - return config; - } - - public void setConfig(Map config) { - this.config = config; - } - - public String getParent() { - return parent; - } - - public void setParent(String parent) { - this.parent = parent; - } - - public static class PropertyConfig { - - @JsonProperty("applicable") - private Boolean applicable; - - @JsonProperty("value") - private Object value; - - public Boolean getApplicable() { - return applicable; - } - - public void setApplicable(Boolean applicable) { - this.applicable = applicable; - } - - - public Object getValue() { - return value; - } - - public void setValue(Object value) { - this.value = value; - } - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ClientTypesRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ClientTypesRepresentation.java deleted file mode 100644 index 9484d18..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ClientTypesRepresentation.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.keycloak.representations.idm; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * @author Marek Posolda - */ -public class ClientTypesRepresentation { - - @JsonProperty("client-types") - private List realmClientTypes; - - @JsonProperty("global-client-types") - private List globalClientTypes; - - public ClientTypesRepresentation() { - } - - public ClientTypesRepresentation(List realmClientTypes, List globalClientTypes) { - this.realmClientTypes = realmClientTypes; - this.globalClientTypes = globalClientTypes; - } - - public List getRealmClientTypes() { - return realmClientTypes; - } - - public void setRealmClientTypes(List realmClientTypes) { - this.realmClientTypes = realmClientTypes; - } - - public List getGlobalClientTypes() { - return globalClientTypes; - } - - public void setGlobalClientTypes(List globalClientTypes) { - this.globalClientTypes = globalClientTypes; - } -} \ No newline at end of file diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ComponentExportRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ComponentExportRepresentation.java deleted file mode 100755 index d9c671d..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ComponentExportRepresentation.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import org.keycloak.common.util.MultivaluedHashMap; - -/** - * @author Marek Posolda - */ -public class ComponentExportRepresentation { - - private String id; - private String name; - private String providerId; - private String subType; - private MultivaluedHashMap subComponents = new MultivaluedHashMap<>(); - private MultivaluedHashMap config = new MultivaluedHashMap<>(); - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public String getSubType() { - return subType; - } - - public void setSubType(String subType) { - this.subType = subType; - } - - public MultivaluedHashMap getConfig() { - return config; - } - - public void setConfig(MultivaluedHashMap config) { - this.config = config; - } - - public MultivaluedHashMap getSubComponents() { - return subComponents; - } - - public void setSubComponents(MultivaluedHashMap subComponents) { - this.subComponents = subComponents; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ComponentRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ComponentRepresentation.java deleted file mode 100755 index 4c9688d..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ComponentRepresentation.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import org.keycloak.common.util.MultivaluedHashMap; - -/** - * @author Marek Posolda - */ -public class ComponentRepresentation { - - public static final String SECRET_VALUE = "**********"; - - private String id; - private String name; - private String providerId; - private String providerType; - private String parentId; - private String subType; - private MultivaluedHashMap config; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public String getProviderType() { - return providerType; - } - - public void setProviderType(String providerType) { - this.providerType = providerType; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public String getSubType() { - return subType; - } - - public void setSubType(String subType) { - this.subType = subType; - } - - public MultivaluedHashMap getConfig() { - return config; - } - - public void setConfig(MultivaluedHashMap config) { - this.config = config; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ComponentRepresentation that = (ComponentRepresentation) o; - - if (!id.equals(that.id)) return false; - - return true; - } - - @Override - public int hashCode() { - return id.hashCode(); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ComponentTypeRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ComponentTypeRepresentation.java deleted file mode 100644 index 1662fa2..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ComponentTypeRepresentation.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author Marek Posolda - */ -public class ComponentTypeRepresentation { - protected String id; - protected String helpText; - protected List properties; - - protected Map metadata = new HashMap<>(); - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getHelpText() { - return helpText; - } - - public void setHelpText(String helpText) { - this.helpText = helpText; - } - - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } - - /** - * Extra information about the component that might come from annotations or interfaces that the component implements - * For example, if UserStorageProvider implements ImportSynchronization - * - * @return - */ - public Map getMetadata() { - return metadata; - } - - public void setMetadata(Map metadata) { - this.metadata = metadata; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ConfigPropertyRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ConfigPropertyRepresentation.java deleted file mode 100755 index f3161c3..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ConfigPropertyRepresentation.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; - -/** -* @author Bill Burke -* @version $Revision: 1 $ -*/ -public class ConfigPropertyRepresentation { - protected String name; - protected String label; - protected String helpText; - protected String type; - protected Object defaultValue; - protected List options; - protected boolean secret; - protected boolean required; - private boolean readOnly; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Object getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(Object defaultValue) { - this.defaultValue = defaultValue; - } - - public String getHelpText() { - return helpText; - } - - public void setHelpText(String helpText) { - this.helpText = helpText; - } - - public List getOptions() { - return options; - } - - public void setOptions(List options) { - this.options = options; - } - - public boolean isSecret() { - return secret; - } - - public void setSecret(boolean secret) { - this.secret = secret; - } - - public boolean isRequired() { - return required; - } - - public void setRequired(boolean required) { - this.required = required; - } - - public void setReadOnly(boolean readOnly) { - this.readOnly = readOnly; - } - - public boolean isReadOnly() { - return readOnly; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/CredentialRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/CredentialRepresentation.java deleted file mode 100755 index 0917196..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/CredentialRepresentation.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import org.keycloak.common.util.MultivaluedHashMap; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class CredentialRepresentation { - public static final String SECRET = "secret"; - public static final String PASSWORD = "password"; - public static final String TOTP = "totp"; - public static final String HOTP = "hotp"; - public static final String KERBEROS = "kerberos"; - - private String id; - private String type; - private String userLabel; - private Long createdDate; - private String secretData; - private String credentialData; - private Integer priority; - - private String value; - - // only used when updating a credential. Might set required action - protected Boolean temporary; - - // All those fields are just for backwards compatibility - @Deprecated - protected String device; - @Deprecated - protected String hashedSaltedValue; - @Deprecated - protected String salt; - @Deprecated - protected Integer hashIterations; - @Deprecated - protected Integer counter; - @Deprecated - private String algorithm; - @Deprecated - private Integer digits; - @Deprecated - private Integer period; - @Deprecated - private MultivaluedHashMap config; - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - - public String getUserLabel() { - return userLabel; - } - public void setUserLabel(String userLabel) { - this.userLabel = userLabel; - } - - public String getSecretData() { - return secretData; - } - public void setSecretData(String secretData) { - this.secretData = secretData; - } - - public String getCredentialData() { - return credentialData; - } - public void setCredentialData(String credentialData) { - this.credentialData = credentialData; - } - - public Integer getPriority() { - return priority; - } - - public void setPriority(Integer priority) { - this.priority = priority; - } - - public Long getCreatedDate() { - return createdDate; - } - public void setCreatedDate(Long createdDate) { - this.createdDate = createdDate; - } - - - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } - - public Boolean isTemporary() { - return temporary; - } - public void setTemporary(Boolean temporary) { - this.temporary = temporary; - } - - @Deprecated - public String getDevice() { - return device; - } - - @Deprecated - public String getHashedSaltedValue() { - return hashedSaltedValue; - } - - @Deprecated - public String getSalt() { - return salt; - } - - @Deprecated - public Integer getHashIterations() { - return hashIterations; - } - - @Deprecated - public Integer getCounter() { - return counter; - } - - @Deprecated - public String getAlgorithm() { - return algorithm; - } - - @Deprecated - public Integer getDigits() { - return digits; - } - - @Deprecated - public Integer getPeriod() { - return period; - } - - @Deprecated - public MultivaluedHashMap getConfig() { - return config; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((createdDate == null) ? 0 : createdDate.hashCode()); - result = prime * result + ((userLabel == null) ? 0 : userLabel.hashCode()); - result = prime * result + ((secretData == null) ? 0 : secretData.hashCode()); - result = prime * result + ((credentialData == null) ? 0 : credentialData.hashCode()); - result = prime * result + ((temporary == null) ? 0 : temporary.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((value == null) ? 0 : value.hashCode()); - result = prime * result + ((priority == null) ? 0 : priority); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CredentialRepresentation other = (CredentialRepresentation) obj; - if (secretData == null) { - if (other.secretData != null) - return false; - } else if (!secretData.equals(other.secretData)) - return false; - if (credentialData == null) { - if (other.credentialData != null) - return false; - } else if (!credentialData.equals(other.credentialData)) - return false; - if (createdDate == null) { - if (other.createdDate != null) - return false; - } else if (!createdDate.equals(other.createdDate)) - return false; - if (userLabel == null) { - if (other.userLabel != null) - return false; - } else if (!userLabel.equals(other.userLabel)) - return false; - if (temporary == null) { - if (other.temporary != null) - return false; - } else if (!temporary.equals(other.temporary)) - return false; - if (type == null) { - if (other.type != null) - return false; - } else if (!type.equals(other.type)) - return false; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - if (value == null) { - if (other.value != null) - return false; - } else if (!value.equals(other.value)) - return false; - if (priority == null) { - if (other.priority != null) - return false; - } else if (!priority.equals(other.priority)) - return false; - return true; - } - - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ErrorRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ErrorRepresentation.java deleted file mode 100644 index e8c3872..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ErrorRepresentation.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; - -/** - * @author Stian Thorgersen - */ -public class ErrorRepresentation { - private String field; - private String errorMessage; - private Object[] params; - private List errors; - - public ErrorRepresentation() { - } - - public ErrorRepresentation(String field, String errorMessage, Object[] params) { - super(); - this.field = field; - this.errorMessage = errorMessage; - this.params = params; - } - - public String getField() { - return field; - } - - public void setField(String field) { - this.field = field; - } - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public Object[] getParams() { - return this.params; - } - - public void setParams(Object[] params) { - this.params = params; - } - - public void setErrors(List errors) { - this.errors = errors; - } - - public List getErrors() { - return errors; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/EventRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/EventRepresentation.java deleted file mode 100644 index 0621b9b..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/EventRepresentation.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors - * as indicated by the @author tags. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.keycloak.representations.idm; - -import java.util.Map; - -/** - * - * @author Stan Silvert ssilvert@redhat.com (C) 2016 Red Hat Inc. - */ -public class EventRepresentation { - - private long time; - private String type; - private String realmId; - private String clientId; - private String userId; - private String sessionId; - private String ipAddress; - private String error; - private Map details; - - public long getTime() { - return time; - } - - public void setTime(long time) { - this.time = time; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getRealmId() { - return realmId; - } - - public void setRealmId(String realmId) { - this.realmId = realmId; - } - - public String getClientId() { - return clientId; - } - - public void setClientId(String clientId) { - this.clientId = clientId; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getSessionId() { - return sessionId; - } - - public void setSessionId(String sessionId) { - this.sessionId = sessionId; - } - - public String getIpAddress() { - return ipAddress; - } - - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } - - public String getError() { - return error; - } - - public void setError(String error) { - this.error = error; - } - - public Map getDetails() { - return details; - } - - public void setDetails(Map details) { - this.details = details; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - EventRepresentation that = (EventRepresentation) o; - - if (time != that.time) return false; - if (type != null ? !type.equals(that.type) : that.type != null) return false; - if (realmId != null ? !realmId.equals(that.realmId) : that.realmId != null) return false; - if (clientId != null ? !clientId.equals(that.clientId) : that.clientId != null) return false; - if (userId != null ? !userId.equals(that.userId) : that.userId != null) return false; - if (sessionId != null ? !sessionId.equals(that.sessionId) : that.sessionId != null) return false; - if (ipAddress != null ? !ipAddress.equals(that.ipAddress) : that.ipAddress != null) return false; - if (error != null ? !error.equals(that.error) : that.error != null) return false; - return !(details != null ? !details.equals(that.details) : that.details != null); - - } - - @Override - public int hashCode() { - int result = (int) (time ^ (time >>> 32)); - result = 31 * result + (type != null ? type.hashCode() : 0); - result = 31 * result + (realmId != null ? realmId.hashCode() : 0); - result = 31 * result + (clientId != null ? clientId.hashCode() : 0); - result = 31 * result + (userId != null ? userId.hashCode() : 0); - result = 31 * result + (sessionId != null ? sessionId.hashCode() : 0); - result = 31 * result + (ipAddress != null ? ipAddress.hashCode() : 0); - result = 31 * result + (error != null ? error.hashCode() : 0); - result = 31 * result + (details != null ? details.hashCode() : 0); - return result; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/FederatedIdentityRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/FederatedIdentityRepresentation.java deleted file mode 100644 index 5b69049..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/FederatedIdentityRepresentation.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * @author Marek Posolda - */ -public class FederatedIdentityRepresentation { - - protected String identityProvider; - protected String userId; - protected String userName; - - public String getIdentityProvider() { - return identityProvider; - } - - public void setIdentityProvider(String identityProvider) { - this.identityProvider = identityProvider; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/GroupRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/GroupRepresentation.java deleted file mode 100755 index d55129a..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/GroupRepresentation.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class GroupRepresentation { - // For an individual group these are the sufficient minimum fields - // to identify a group and operate on it in a basic way - protected String id; - protected String name; - protected String path; - protected String parentId; - protected Long subGroupCount; - // For navigating a hierarchy of groups, we can also include a minimum representation of subGroups - // These aren't populated by default and are only included as-needed - protected List subGroups; - protected Map> attributes; - protected List realmRoles; - protected Map> clientRoles; - - private Map access; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public Long getSubGroupCount() { - return subGroupCount; - } - - public void setSubGroupCount(Long subGroupCount) { - this.subGroupCount = subGroupCount; - } - - public List getRealmRoles() { - return realmRoles; - } - - public void setRealmRoles(List realmRoles) { - this.realmRoles = realmRoles; - } - - public Map> getClientRoles() { - return clientRoles; - } - - public void setClientRoles(Map> clientRoles) { - this.clientRoles = clientRoles; - } - - - public Map> getAttributes() { - return attributes; - } - - public void setAttributes(Map> attributes) { - this.attributes = attributes; - } - - public GroupRepresentation singleAttribute(String name, String value) { - if (this.attributes == null) attributes = new HashMap<>(); - attributes.put(name, Arrays.asList(value)); - return this; - } - - public List getSubGroups() { - if(subGroups == null) { - subGroups = new ArrayList<>(); - } - return subGroups; - } - - public void setSubGroups(List subGroups) { - this.subGroups = subGroups; - } - - public Map getAccess() { - return access; - } - - public void setAccess(Map access) { - this.access = access; - } - - public void merge(GroupRepresentation g) { - merge(this, g); - } - - private void merge(GroupRepresentation g1, GroupRepresentation g2) { - if(g1.equals(g2)) { - Map g1Children = g1.getSubGroups().stream().collect(Collectors.toMap(GroupRepresentation::getId, g -> g)); - Map g2Children = g2.getSubGroups().stream().collect(Collectors.toMap(GroupRepresentation::getId, g -> g)); - - g2Children.forEach((key, value) -> { - if (g1Children.containsKey(key)) { - merge(g1Children.get(key), value); - } else { - g1Children.put(key, value); - } - }); - g1.setSubGroups(new ArrayList<>(g1Children.values())); - } - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GroupRepresentation that = (GroupRepresentation) o; - boolean isEqual = Objects.equals(id, that.id) && Objects.equals(parentId, that.parentId); - if(isEqual) { - return true; - } else { - return Objects.equals(name, that.name) && Objects.equals(path, that.path); - } - } - - @Override - public int hashCode() { - if(id == null) { - return Objects.hash(name, path); - } - return Objects.hash(id, parentId); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/IdentityProviderMapperRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/IdentityProviderMapperRepresentation.java deleted file mode 100755 index 1627c23..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/IdentityProviderMapperRepresentation.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class IdentityProviderMapperRepresentation { - protected String id; - protected String name; - protected String identityProviderAlias; - protected String identityProviderMapper; - protected Map config = new HashMap<>(); - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getIdentityProviderAlias() { - return identityProviderAlias; - } - - public void setIdentityProviderAlias(String identityProviderAlias) { - this.identityProviderAlias = identityProviderAlias; - } - - public String getIdentityProviderMapper() { - return identityProviderMapper; - } - - public void setIdentityProviderMapper(String identityProviderMapper) { - this.identityProviderMapper = identityProviderMapper; - } - - public Map getConfig() { - return config; - } - - public void setConfig(Map config) { - this.config = config; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/IdentityProviderMapperTypeRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/IdentityProviderMapperTypeRepresentation.java deleted file mode 100755 index 3f769a1..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/IdentityProviderMapperTypeRepresentation.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.LinkedList; -import java.util.List; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class IdentityProviderMapperTypeRepresentation { - protected String id; - protected String name; - protected String category; - protected String helpText; - - protected List properties = new LinkedList<>(); - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getHelpText() { - return helpText; - } - - public void setHelpText(String helpText) { - this.helpText = helpText; - } - - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/IdentityProviderRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/IdentityProviderRepresentation.java deleted file mode 100755 index 9ca5a0d..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/IdentityProviderRepresentation.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Pedro Igor - */ -public class IdentityProviderRepresentation { - - protected String alias; - protected String displayName; - protected String internalId; - protected String providerId; - protected boolean enabled = true; - - public static final String UPFLM_ON = "on"; - public static final String UPFLM_MISSING = "missing"; - public static final String UPFLM_OFF = "off"; - - /** - * Mode of profile update after first login when user is created over this identity provider. Possible values: - *
    - *
  • on - update profile page is presented for all users - *
  • missing - update profile page is presented for users with missing some of mandatory user profile fields - *
  • off - update profile page is newer shown after first login - *
- * - * @see #UPFLM_ON - * @see #UPFLM_MISSING - * @see #UPFLM_OFF - */ - @Deprecated - protected String updateProfileFirstLoginMode = UPFLM_ON; - - protected boolean trustEmail; - protected boolean storeToken; - protected boolean addReadTokenRoleOnCreate; - protected boolean authenticateByDefault; - protected boolean linkOnly; - protected String firstBrokerLoginFlowAlias; - protected String postBrokerLoginFlowAlias; - protected Map config = new HashMap<>(); - - public String getInternalId() { - return this.internalId; - } - - public void setInternalId(String internalId) { - this.internalId = internalId; - } - - public String getAlias() { - return this.alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } - - public String getProviderId() { - return this.providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public Map getConfig() { - return this.config; - } - - public void setConfig(Map config) { - this.config = config; - } - - public boolean isEnabled() { - return this.enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public boolean isLinkOnly() { - return linkOnly; - } - - public void setLinkOnly(boolean linkOnly) { - this.linkOnly = linkOnly; - } - - /** - * - * Deprecated because replaced by {@link #updateProfileFirstLoginMode}. Kept here to allow import of old realms. - * - * @deprecated {@link #setUpdateProfileFirstLoginMode(String)} - */ - @Deprecated - public void setUpdateProfileFirstLogin(boolean updateProfileFirstLogin) { - this.updateProfileFirstLoginMode = updateProfileFirstLogin ? UPFLM_ON : UPFLM_OFF; - } - - /** - * @deprecated deprecated and replaced by configuration on IdpReviewProfileAuthenticator - */ - @Deprecated - public String getUpdateProfileFirstLoginMode() { - return updateProfileFirstLoginMode; - } - - /** - * @deprecated deprecated and replaced by configuration on IdpReviewProfileAuthenticator - */ - @Deprecated - public void setUpdateProfileFirstLoginMode(String updateProfileFirstLoginMode) { - this.updateProfileFirstLoginMode = updateProfileFirstLoginMode; - } - - /** - * @deprecated Replaced by configuration option in identity provider authenticator - */ - @Deprecated - public boolean isAuthenticateByDefault() { - return authenticateByDefault; - } - - @Deprecated - public void setAuthenticateByDefault(boolean authenticateByDefault) { - this.authenticateByDefault = authenticateByDefault; - } - - public String getFirstBrokerLoginFlowAlias() { - return firstBrokerLoginFlowAlias; - } - - public void setFirstBrokerLoginFlowAlias(String firstBrokerLoginFlowAlias) { - this.firstBrokerLoginFlowAlias = firstBrokerLoginFlowAlias; - } - - public String getPostBrokerLoginFlowAlias() { - return postBrokerLoginFlowAlias; - } - - public void setPostBrokerLoginFlowAlias(String postBrokerLoginFlowAlias) { - this.postBrokerLoginFlowAlias = postBrokerLoginFlowAlias; - } - - public boolean isStoreToken() { - return this.storeToken; - } - - public void setStoreToken(boolean storeToken) { - this.storeToken = storeToken; - } - - public boolean isAddReadTokenRoleOnCreate() { - return addReadTokenRoleOnCreate; - } - - public void setAddReadTokenRoleOnCreate(boolean addReadTokenRoleOnCreate) { - this.addReadTokenRoleOnCreate = addReadTokenRoleOnCreate; - } - - public boolean isTrustEmail() { - return trustEmail; - } - - public void setTrustEmail(boolean trustEmail) { - this.trustEmail = trustEmail; - } - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/KeysMetadataRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/KeysMetadataRepresentation.java deleted file mode 100644 index aa5fdfb..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/KeysMetadataRepresentation.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; -import java.util.Map; - -import org.keycloak.crypto.KeyUse; - -/** - * @author Stian Thorgersen - */ -public class KeysMetadataRepresentation { - - private Map active; - - private List keys; - - public Map getActive() { - return active; - } - - public void setActive(Map active) { - this.active = active; - } - - public List getKeys() { - return keys; - } - - public void setKeys(List keys) { - this.keys = keys; - } - - public static class KeyMetadataRepresentation { - private String providerId; - private long providerPriority; - - private String kid; - - private String status; - - private String type; - private String algorithm; - - private String publicKey; - private String certificate; - private KeyUse use; - private Long validTo; - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public long getProviderPriority() { - return providerPriority; - } - - public void setProviderPriority(long providerPriority) { - this.providerPriority = providerPriority; - } - - public String getKid() { - return kid; - } - - public void setKid(String kid) { - this.kid = kid; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getAlgorithm() { - return algorithm; - } - - public void setAlgorithm(String algorithm) { - this.algorithm = algorithm; - } - - public String getPublicKey() { - return publicKey; - } - - public void setPublicKey(String publicKey) { - this.publicKey = publicKey; - } - - public String getCertificate() { - return certificate; - } - - public void setCertificate(String certificate) { - this.certificate = certificate; - } - - public KeyUse getUse() { - return use; - } - - public void setUse(KeyUse use) { - this.use = use; - } - - public Long getValidTo() { - return validTo; - } - - public void setValidTo(Long validTo) { - this.validTo = validTo; - } - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/LDAPCapabilityRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/LDAPCapabilityRepresentation.java deleted file mode 100644 index 3933bb0..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/LDAPCapabilityRepresentation.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2019 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.keycloak.representations.idm; - -import java.util.Objects; - -import org.keycloak.common.util.ObjectUtil; - -/** - * Value object to represent an OID (object identifier) as used to describe LDAP schema, extension and features. - * See LDAP OID Reference Guide. - * - * @author Lars Uffmann, 2020-05-13 - * @since 11.0 - */ -public class LDAPCapabilityRepresentation { - - public enum CapabilityType { - CONTROL, - EXTENSION, - FEATURE, - UNKNOWN; - - public static CapabilityType fromRootDseAttributeName(String attributeName) { - switch (attributeName) { - case "supportedExtension": return CapabilityType.EXTENSION; - case "supportedControl": return CapabilityType.CONTROL; - case "supportedFeatures": return CapabilityType.FEATURE; - default: return CapabilityType.UNKNOWN; - } - } - }; - - private Object oid; - - private CapabilityType type; - - public LDAPCapabilityRepresentation() { - } - - public LDAPCapabilityRepresentation(Object oidValue, CapabilityType type) { - this.oid = Objects.requireNonNull(oidValue); - this.type = type; - } - - public String getOid() { - return oid instanceof String ? (String) oid : String.valueOf(oid); - } - - public CapabilityType getType() { - return type; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - LDAPCapabilityRepresentation ldapOid = (LDAPCapabilityRepresentation) o; - return ObjectUtil.isEqualOrBothNull(oid, ldapOid.oid) && ObjectUtil.isEqualOrBothNull(type, ldapOid.type); - } - - @Override - public int hashCode() { - return oid.hashCode(); - } - - @Override - public String toString() { - return new StringBuilder(LDAPCapabilityRepresentation.class.getSimpleName() + "[ ") - .append("oid=" + oid + ", ") - .append("type=" + type + " ]") - .toString(); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ManagementPermissionReference.java b/authz-client/src/main/java/org/keycloak/representations/idm/ManagementPermissionReference.java deleted file mode 100644 index 22550d6..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ManagementPermissionReference.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm; - -import java.util.Map; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class ManagementPermissionReference { - private boolean enabled; - private String resource; - private Map scopePermissions; - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public String getResource() { - return resource; - } - - public void setResource(String resource) { - this.resource = resource; - } - - public Map getScopePermissions() { - return scopePermissions; - } - - public void setScopePermissions(Map scopePermissions) { - this.scopePermissions = scopePermissions; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ManagementPermissionRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ManagementPermissionRepresentation.java deleted file mode 100644 index 39af147..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ManagementPermissionRepresentation.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2018 Bosch Software Innovations GmbH - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * @author Leon Graser - */ -public class ManagementPermissionRepresentation { - - private final boolean enabled; - - public ManagementPermissionRepresentation(boolean enabled) { - this.enabled = enabled; - } - - public boolean isEnabled() { - return enabled; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/MappingsRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/MappingsRepresentation.java deleted file mode 100755 index 3c35b4b..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/MappingsRepresentation.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; -import java.util.Map; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class MappingsRepresentation { - protected List realmMappings; - protected Map clientMappings; - - public List getRealmMappings() { - return realmMappings; - } - - public void setRealmMappings(List realmMappings) { - this.realmMappings = realmMappings; - } - - public Map getClientMappings() { - return clientMappings; - } - - public void setClientMappings(Map clientMappings) { - this.clientMappings = clientMappings; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/MemberRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/MemberRepresentation.java deleted file mode 100644 index 17b41e7..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/MemberRepresentation.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2024 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -public class MemberRepresentation extends UserRepresentation { - - private MembershipType membershipType; - - public MemberRepresentation() { - super(); - } - - public MemberRepresentation(UserRepresentation user) { - super(user); - } - - public MembershipType getMembershipType() { - return membershipType; - } - - public void setMembershipType(MembershipType membershipType) { - this.membershipType = membershipType; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/OAuth2ErrorRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/OAuth2ErrorRepresentation.java deleted file mode 100644 index f988013..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/OAuth2ErrorRepresentation.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.keycloak.OAuth2Constants; - -/** - * @author Marek Posolda - */ -public class OAuth2ErrorRepresentation { - - private String error; - private String errorDescription; - - public OAuth2ErrorRepresentation() { - } - - public OAuth2ErrorRepresentation(String error, String errorDescription) { - this.error = error; - this.errorDescription = errorDescription; - } - - @JsonProperty(OAuth2Constants.ERROR) - public String getError() { - return error; - } - - public void setError(String error) { - this.error = error; - } - - @JsonProperty(OAuth2Constants.ERROR_DESCRIPTION) - public String getErrorDescription() { - return errorDescription; - } - - public void setErrorDescription(String errorDescription) { - this.errorDescription = errorDescription; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/OAuthClientRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/OAuthClientRepresentation.java deleted file mode 100755 index 474ab34..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/OAuthClientRepresentation.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -@Deprecated -public class OAuthClientRepresentation extends ApplicationRepresentation { -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/OrganizationDomainRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/OrganizationDomainRepresentation.java deleted file mode 100644 index 02d9945..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/OrganizationDomainRepresentation.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2024 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * Representation implementation of an organization internet domain. - * - * @author Stefan Guilhen - */ -public class OrganizationDomainRepresentation { - - private String name; - private boolean verified; - - public OrganizationDomainRepresentation() { - // for reflection - } - - public OrganizationDomainRepresentation(String name) { - this.name = name; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - public boolean isVerified() { - return this.verified; - } - - public void setVerified(boolean verified) { - this.verified = verified; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null) return false; - if (!(o instanceof OrganizationDomainRepresentation)) return false; - - OrganizationDomainRepresentation that = (OrganizationDomainRepresentation) o; - return name != null && name.equals(that.getName()); - } - - @Override - public int hashCode() { - if (name == null) { - return super.hashCode(); - } - return name.hashCode(); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/OrganizationRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/OrganizationRepresentation.java deleted file mode 100644 index 5d0cf29..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/OrganizationRepresentation.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 2024 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.HashSet; -import java.util.Set; - -public class OrganizationRepresentation { - - private String id; - private String name; - private String alias; - private boolean enabled = true; - private String description; - private Map> attributes; - private Set domains; - private List members; - private List identityProviders; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public String getAlias() { - return alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } - - public boolean isEnabled() { - return this.enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Map> getAttributes() { - return attributes; - } - - public void setAttributes(Map> attributes) { - this.attributes = attributes; - } - - public OrganizationRepresentation singleAttribute(String name, String value) { - if (this.attributes == null) attributes = new HashMap<>(); - attributes.put(name, Arrays.asList(value)); - return this; - } - - public Set getDomains() { - return domains; - } - - public OrganizationDomainRepresentation getDomain(String name) { - if (domains == null) { - return null; - } - return domains.stream() - .filter(organizationDomainRepresentation -> name.equals(organizationDomainRepresentation.getName())) - .findAny() - .orElse(null); - } - - public void addDomain(OrganizationDomainRepresentation domain) { - if (domains == null) { - domains = new HashSet<>(); - } - domains.add(domain); - } - - public void removeDomain(OrganizationDomainRepresentation domain) { - if (domains == null) { - return; - } - getDomains().remove(domain); - } - - public List getMembers() { - return members; - } - - public void setMembers(List members) { - this.members = members; - } - - public void addMember(MemberRepresentation member) { - if (members == null) { - members = new ArrayList<>(); - } - members.add(member); - } - - public List getIdentityProviders() { - return identityProviders; - } - - public void setIdentityProviders(List identityProviders) { - this.identityProviders = identityProviders; - } - - public void addIdentityProvider(IdentityProviderRepresentation idp) { - if (identityProviders == null) { - identityProviders = new ArrayList<>(); - } - identityProviders.add(idp); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null) return false; - if (!(o instanceof OrganizationRepresentation)) return false; - - OrganizationRepresentation that = (OrganizationRepresentation) o; - - return id != null && id.equals(that.getId()); - } - - @Override - public int hashCode() { - if (id == null) { - return super.hashCode(); - } - return id.hashCode(); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/PartialImportRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/PartialImportRepresentation.java deleted file mode 100644 index 9046d3d..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/PartialImportRepresentation.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -import java.util.List; - -/** - * Used for partial import of users, groups, clients, roles, and identity providers. - * - * @author Stan Silvert ssilvert@redhat.com (C) 2016 Red Hat Inc. - */ -@JsonIgnoreProperties(ignoreUnknown=true) -public class PartialImportRepresentation { - public enum Policy { SKIP, OVERWRITE, FAIL }; - - protected Policy policy = Policy.FAIL; - protected String ifResourceExists; - protected List users; - protected List groups; - protected List clients; - protected List identityProviders; - protected List identityProviderMappers; - protected RolesRepresentation roles; - - public boolean hasUsers() { - return (users != null) && !users.isEmpty(); - } - - public boolean hasGroups() { - return (groups != null) && !groups.isEmpty(); - } - - public boolean hasClients() { - return (clients != null) && !clients.isEmpty(); - } - - public boolean hasIdps() { - return (identityProviders != null) && !identityProviders.isEmpty(); - } - - public boolean hasRealmRoles() { - return (roles != null) && (roles.getRealm() != null) && (!roles.getRealm().isEmpty()); - } - - public boolean hasClientRoles() { - return (roles != null) && (roles.getClient() != null) && (!roles.getClient().isEmpty()); - } - - public String getIfResourceExists() { - return ifResourceExists; - } - - public void setIfResourceExists(String ifResourceExists) { - this.ifResourceExists = ifResourceExists; - this.policy = ifResourceExists != null ? Policy.valueOf(ifResourceExists) : null; - } - - public Policy getPolicy() { - return this.policy; - } - - public List getUsers() { - return users; - } - - public void setUsers(List users) { - this.users = users; - } - - public List getClients() { - return clients; - } - - public List getGroups() { - return groups; - } - - public void setGroups(List groups) { - this.groups = groups; - } - - public void setClients(List clients) { - this.clients = clients; - } - - public List getIdentityProviders() { - return identityProviders; - } - - public void setIdentityProviders(List identityProviders) { - this.identityProviders = identityProviders; - } - - public List getIdentityProviderMappers() { - return identityProviderMappers; - } - - public void setIdentityProviderMappers(List identityProviderMappers) { - this.identityProviderMappers = identityProviderMappers; - } - - public RolesRepresentation getRoles() { - return roles; - } - - public void setRoles(RolesRepresentation roles) { - this.roles = roles; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/PasswordPolicyTypeRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/PasswordPolicyTypeRepresentation.java deleted file mode 100644 index 5a5a1f9..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/PasswordPolicyTypeRepresentation.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * @author Stian Thorgersen - */ -public class PasswordPolicyTypeRepresentation { - - private String id; - private String displayName; - private String configType; - private String defaultValue; - private boolean multipleSupported; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public String getConfigType() { - return configType; - } - - public void setConfigType(String configType) { - this.configType = configType; - } - - public String getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - public boolean isMultipleSupported() { - return multipleSupported; - } - - public void setMultipleSupported(boolean multipleSupported) { - this.multipleSupported = multipleSupported; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ProtocolMapperRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ProtocolMapperRepresentation.java deleted file mode 100755 index 354c4b5..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ProtocolMapperRepresentation.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class ProtocolMapperRepresentation { - protected String id; - protected String name; - protected String protocol; - protected String protocolMapper; - - @Deprecated // backwards compatibility only - protected boolean consentRequired; - - @Deprecated // backwards compatibility only - protected String consentText; - protected Map config = new HashMap<>(); - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public String getProtocolMapper() { - return protocolMapper; - } - - public void setProtocolMapper(String protocolMapper) { - this.protocolMapper = protocolMapper; - } - - public Map getConfig() { - return config; - } - - public void setConfig(Map config) { - this.config = config; - } - - @Deprecated - public boolean isConsentRequired() { - return consentRequired; - } - - @Deprecated - public String getConsentText() { - return consentText; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ProtocolMapperTypeRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ProtocolMapperTypeRepresentation.java deleted file mode 100755 index 205fb2b..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ProtocolMapperTypeRepresentation.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class ProtocolMapperTypeRepresentation { - protected String id; - protected String name; - protected String category; - protected String helpText; - protected int priority; - - protected List properties; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getHelpText() { - return helpText; - } - - public void setHelpText(String helpText) { - this.helpText = helpText; - } - - public int getPriority() { - return priority; - } - - public void setPriority(int priority) { - this.priority = priority; - } - - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/PublishedRealmRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/PublishedRealmRepresentation.java deleted file mode 100755 index b3546eb..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/PublishedRealmRepresentation.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class PublishedRealmRepresentation { - protected String realm; - - @JsonProperty("public_key") - protected String publicKeyPem; - - @JsonProperty("token-service") - protected String tokenServiceUrl; - - @JsonProperty("account-service") - protected String accountServiceUrl; - - @JsonProperty("tokens-not-before") - protected int notBefore; - - public String getRealm() { - return realm; - } - - public void setRealm(String realm) { - this.realm = realm; - } - - public String getPublicKeyPem() { - return publicKeyPem; - } - - public void setPublicKeyPem(String publicKeyPem) { - this.publicKeyPem = publicKeyPem; - } - - public String getTokenServiceUrl() { - return tokenServiceUrl; - } - - public void setTokenServiceUrl(String tokenServiceUrl) { - this.tokenServiceUrl = tokenServiceUrl; - } - - public String getAccountServiceUrl() { - return accountServiceUrl; - } - - public void setAccountServiceUrl(String accountServiceUrl) { - this.accountServiceUrl = accountServiceUrl; - } - - public int getNotBefore() { - return notBefore; - } - - public void setNotBefore(int notBefore) { - this.notBefore = notBefore; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/RealmEventsConfigRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/RealmEventsConfigRepresentation.java deleted file mode 100755 index ab72508..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/RealmEventsConfigRepresentation.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class RealmEventsConfigRepresentation { - protected boolean eventsEnabled; - protected Long eventsExpiration; - protected List eventsListeners; - protected List enabledEventTypes; - - protected Boolean adminEventsEnabled; - protected Boolean adminEventsDetailsEnabled; - - public boolean isEventsEnabled() { - return eventsEnabled; - } - - public void setEventsEnabled(boolean eventsEnabled) { - this.eventsEnabled = eventsEnabled; - } - - public Long getEventsExpiration() { - return eventsExpiration; - } - - public void setEventsExpiration(Long eventsExpiration) { - this.eventsExpiration = eventsExpiration; - } - - public List getEventsListeners() { - return eventsListeners; - } - - public void setEventsListeners(List eventsListeners) { - this.eventsListeners = eventsListeners; - } - - public List getEnabledEventTypes() { - return enabledEventTypes; - } - - public void setEnabledEventTypes(List enabledEventTypes) { - this.enabledEventTypes = enabledEventTypes; - } - - public Boolean isAdminEventsEnabled() { - return adminEventsEnabled; - } - - public void setAdminEventsEnabled(Boolean adminEventsEnabled) { - this.adminEventsEnabled = adminEventsEnabled; - } - - public Boolean isAdminEventsDetailsEnabled() { - return adminEventsDetailsEnabled; - } - - public void setAdminEventsDetailsEnabled(Boolean adminEventsDetailsEnabled) { - this.adminEventsDetailsEnabled = adminEventsDetailsEnabled; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java deleted file mode 100755 index 3e34783..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java +++ /dev/null @@ -1,1453 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import org.eclipse.microprofile.openapi.annotations.media.Schema; -import org.jboss.logging.Logger; -import org.keycloak.common.util.MultivaluedHashMap; -import org.keycloak.util.JsonSerialization; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class RealmRepresentation { - - private static final Logger logger = Logger.getLogger(RealmRepresentation.class); - - protected String id; - protected String realm; - protected String displayName; - protected String displayNameHtml; - protected Integer notBefore; - protected String defaultSignatureAlgorithm; - protected Boolean revokeRefreshToken; - protected Integer refreshTokenMaxReuse; - protected Integer accessTokenLifespan; - protected Integer accessTokenLifespanForImplicitFlow; - protected Integer ssoSessionIdleTimeout; - protected Integer ssoSessionMaxLifespan; - protected Integer ssoSessionIdleTimeoutRememberMe; - protected Integer ssoSessionMaxLifespanRememberMe; - protected Integer offlineSessionIdleTimeout; - // KEYCLOAK-7688 Offline Session Max for Offline Token - protected Boolean offlineSessionMaxLifespanEnabled; - protected Integer offlineSessionMaxLifespan; - protected Integer clientSessionIdleTimeout; - protected Integer clientSessionMaxLifespan; - protected Integer clientOfflineSessionIdleTimeout; - protected Integer clientOfflineSessionMaxLifespan; - protected Integer accessCodeLifespan; - protected Integer accessCodeLifespanUserAction; - protected Integer accessCodeLifespanLogin; - protected Integer actionTokenGeneratedByAdminLifespan; - protected Integer actionTokenGeneratedByUserLifespan; - protected Integer oauth2DeviceCodeLifespan; - protected Integer oauth2DevicePollingInterval; - protected Boolean enabled; - protected String sslRequired; - @Deprecated - protected Boolean passwordCredentialGrantAllowed; - protected Boolean registrationAllowed; - protected Boolean registrationEmailAsUsername; - protected Boolean rememberMe; - protected Boolean verifyEmail; - protected Boolean loginWithEmailAllowed; - protected Boolean duplicateEmailsAllowed; - protected Boolean resetPasswordAllowed; - protected Boolean editUsernameAllowed; - - @Deprecated - protected Boolean userCacheEnabled; - @Deprecated - protected Boolean realmCacheEnabled; - - //--- brute force settings - protected Boolean bruteForceProtected; - protected Boolean permanentLockout; - protected Integer maxTemporaryLockouts; - protected Integer maxFailureWaitSeconds; - protected Integer minimumQuickLoginWaitSeconds; - protected Integer waitIncrementSeconds; - protected Long quickLoginCheckMilliSeconds; - protected Integer maxDeltaTimeSeconds; - protected Integer failureFactor; - //--- end brute force settings - - @Deprecated - protected String privateKey; - @Deprecated - protected String publicKey; - @Deprecated - protected String certificate; - @Deprecated - protected String codeSecret; - protected RolesRepresentation roles; - protected List groups; - @Deprecated - protected List defaultRoles; - protected RoleRepresentation defaultRole; - protected List defaultGroups; - @Deprecated - protected Set requiredCredentials; - protected String passwordPolicy; - protected String otpPolicyType; - protected String otpPolicyAlgorithm; - protected Integer otpPolicyInitialCounter; - protected Integer otpPolicyDigits; - protected Integer otpPolicyLookAheadWindow; - protected Integer otpPolicyPeriod; - protected Boolean otpPolicyCodeReusable; - protected List otpSupportedApplications; - protected Map> localizationTexts; - - // WebAuthn 2-factor properties below - - protected String webAuthnPolicyRpEntityName; - protected List webAuthnPolicySignatureAlgorithms; - protected String webAuthnPolicyRpId; - protected String webAuthnPolicyAttestationConveyancePreference; - protected String webAuthnPolicyAuthenticatorAttachment; - protected String webAuthnPolicyRequireResidentKey; - protected String webAuthnPolicyUserVerificationRequirement; - protected Integer webAuthnPolicyCreateTimeout; - protected Boolean webAuthnPolicyAvoidSameAuthenticatorRegister; - protected List webAuthnPolicyAcceptableAaguids; - protected List webAuthnPolicyExtraOrigins; - - // WebAuthn passwordless properties below - - protected String webAuthnPolicyPasswordlessRpEntityName; - protected List webAuthnPolicyPasswordlessSignatureAlgorithms; - protected String webAuthnPolicyPasswordlessRpId; - protected String webAuthnPolicyPasswordlessAttestationConveyancePreference; - protected String webAuthnPolicyPasswordlessAuthenticatorAttachment; - protected String webAuthnPolicyPasswordlessRequireResidentKey; - protected String webAuthnPolicyPasswordlessUserVerificationRequirement; - protected Integer webAuthnPolicyPasswordlessCreateTimeout; - protected Boolean webAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister; - protected List webAuthnPolicyPasswordlessAcceptableAaguids; - protected List webAuthnPolicyPasswordlessExtraOrigins; - - // Client Policies/Profiles - - @JsonProperty("clientProfiles") - @Schema(implementation = ClientProfilesRepresentation.class) - protected JsonNode clientProfiles; - - @JsonProperty("clientPolicies") - @Schema(implementation = ClientPoliciesRepresentation.class) - protected JsonNode clientPolicies; - - protected List users; - protected List federatedUsers; - protected List scopeMappings; - protected Map> clientScopeMappings; - protected List clients; - protected List clientScopes; - protected List defaultDefaultClientScopes; - protected List defaultOptionalClientScopes; - protected Map browserSecurityHeaders; - protected Map smtpServer; - protected List userFederationProviders; - protected List userFederationMappers; - protected String loginTheme; - protected String accountTheme; - protected String adminTheme; - protected String emailTheme; - - protected Boolean eventsEnabled; - protected Long eventsExpiration; - protected List eventsListeners; - protected List enabledEventTypes; - - protected Boolean adminEventsEnabled; - protected Boolean adminEventsDetailsEnabled; - - private List identityProviders; - private List identityProviderMappers; - private List protocolMappers; - private MultivaluedHashMap components; - protected Boolean internationalizationEnabled; - protected Set supportedLocales; - protected String defaultLocale; - protected List authenticationFlows; - protected List authenticatorConfig; - protected List requiredActions; - protected String browserFlow; - protected String registrationFlow; - protected String directGrantFlow; - protected String resetCredentialsFlow; - protected String clientAuthenticationFlow; - protected String dockerAuthenticationFlow; - protected String firstBrokerLoginFlow; - - protected Map attributes; - - protected String keycloakVersion; - - protected Boolean userManagedAccessAllowed; - - protected Boolean organizationsEnabled; - private List organizations; - - @Deprecated - protected Boolean social; - @Deprecated - protected Boolean updateProfileOnInitialSocialLogin; - @Deprecated - protected Map socialProviders; - @Deprecated - protected Map> applicationScopeMappings; - @Deprecated - protected List applications; - @Deprecated - protected List oauthClients; - @Deprecated - protected List clientTemplates; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getRealm() { - return realm; - } - - public void setRealm(String realm) { - this.realm = realm; - } - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public String getDisplayNameHtml() { - return displayNameHtml; - } - - public void setDisplayNameHtml(String displayNameHtml) { - this.displayNameHtml = displayNameHtml; - } - - public List getUsers() { - return users; - } - - public List getApplications() { - return applications; - } - - public void setUsers(List users) { - this.users = users; - } - - public UserRepresentation user(String username) { - UserRepresentation user = new UserRepresentation(); - user.setUsername(username); - if (users == null) users = new ArrayList<>(); - users.add(user); - return user; - } - - public List getClients() { - return clients; - } - - public void setClients(List clients) { - this.clients = clients; - } - - public Boolean isEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - public String getSslRequired() { - return sslRequired; - } - - public void setSslRequired(String sslRequired) { - this.sslRequired = sslRequired; - } - - public String getDefaultSignatureAlgorithm() { - return defaultSignatureAlgorithm; - } - - public void setDefaultSignatureAlgorithm(String defaultSignatureAlgorithm) { - this.defaultSignatureAlgorithm = defaultSignatureAlgorithm; - } - - public Boolean getRevokeRefreshToken() { - return revokeRefreshToken; - } - - public void setRevokeRefreshToken(Boolean revokeRefreshToken) { - this.revokeRefreshToken = revokeRefreshToken; - } - - public Integer getRefreshTokenMaxReuse() { - return refreshTokenMaxReuse; - } - - public void setRefreshTokenMaxReuse(Integer refreshTokenMaxReuse) { - this.refreshTokenMaxReuse = refreshTokenMaxReuse; - } - - public Integer getAccessTokenLifespan() { - return accessTokenLifespan; - } - - public void setAccessTokenLifespan(Integer accessTokenLifespan) { - this.accessTokenLifespan = accessTokenLifespan; - } - - public Integer getAccessTokenLifespanForImplicitFlow() { - return accessTokenLifespanForImplicitFlow; - } - - public void setAccessTokenLifespanForImplicitFlow(Integer accessTokenLifespanForImplicitFlow) { - this.accessTokenLifespanForImplicitFlow = accessTokenLifespanForImplicitFlow; - } - - public Integer getSsoSessionIdleTimeout() { - return ssoSessionIdleTimeout; - } - - public void setSsoSessionIdleTimeout(Integer ssoSessionIdleTimeout) { - this.ssoSessionIdleTimeout = ssoSessionIdleTimeout; - } - - public Integer getSsoSessionMaxLifespan() { - return ssoSessionMaxLifespan; - } - - public void setSsoSessionMaxLifespan(Integer ssoSessionMaxLifespan) { - this.ssoSessionMaxLifespan = ssoSessionMaxLifespan; - } - - public Integer getSsoSessionMaxLifespanRememberMe() { - return ssoSessionMaxLifespanRememberMe; - } - - public void setSsoSessionMaxLifespanRememberMe(Integer ssoSessionMaxLifespanRememberMe) { - this.ssoSessionMaxLifespanRememberMe = ssoSessionMaxLifespanRememberMe; - } - - public Integer getSsoSessionIdleTimeoutRememberMe() { - return ssoSessionIdleTimeoutRememberMe; - } - - public void setSsoSessionIdleTimeoutRememberMe(Integer ssoSessionIdleTimeoutRememberMe) { - this.ssoSessionIdleTimeoutRememberMe = ssoSessionIdleTimeoutRememberMe; - } - - public Integer getOfflineSessionIdleTimeout() { - return offlineSessionIdleTimeout; - } - - public void setOfflineSessionIdleTimeout(Integer offlineSessionIdleTimeout) { - this.offlineSessionIdleTimeout = offlineSessionIdleTimeout; - } - - // KEYCLOAK-7688 Offline Session Max for Offline Token - public Boolean getOfflineSessionMaxLifespanEnabled() { - return offlineSessionMaxLifespanEnabled; - } - - public void setOfflineSessionMaxLifespanEnabled(Boolean offlineSessionMaxLifespanEnabled) { - this.offlineSessionMaxLifespanEnabled = offlineSessionMaxLifespanEnabled; - } - - public Integer getOfflineSessionMaxLifespan() { - return offlineSessionMaxLifespan; - } - - public void setOfflineSessionMaxLifespan(Integer offlineSessionMaxLifespan) { - this.offlineSessionMaxLifespan = offlineSessionMaxLifespan; - } - - public Integer getClientSessionIdleTimeout() { - return clientSessionIdleTimeout; - } - - public void setClientSessionIdleTimeout(Integer clientSessionIdleTimeout) { - this.clientSessionIdleTimeout = clientSessionIdleTimeout; - } - - public Integer getClientSessionMaxLifespan() { - return clientSessionMaxLifespan; - } - - public void setClientSessionMaxLifespan(Integer clientSessionMaxLifespan) { - this.clientSessionMaxLifespan = clientSessionMaxLifespan; - } - - public Integer getClientOfflineSessionIdleTimeout() { - return clientOfflineSessionIdleTimeout; - } - - public void setClientOfflineSessionIdleTimeout(Integer clientOfflineSessionIdleTimeout) { - this.clientOfflineSessionIdleTimeout = clientOfflineSessionIdleTimeout; - } - - public Integer getClientOfflineSessionMaxLifespan() { - return clientOfflineSessionMaxLifespan; - } - - public void setClientOfflineSessionMaxLifespan(Integer clientOfflineSessionMaxLifespan) { - this.clientOfflineSessionMaxLifespan = clientOfflineSessionMaxLifespan; - } - - public List getScopeMappings() { - return scopeMappings; - } - - public ScopeMappingRepresentation clientScopeMapping(String clientName) { - ScopeMappingRepresentation mapping = new ScopeMappingRepresentation(); - mapping.setClient(clientName); - if (scopeMappings == null) scopeMappings = new ArrayList<>(); - scopeMappings.add(mapping); - return mapping; - } - - public ScopeMappingRepresentation clientScopeScopeMapping(String clientScopeName) { - ScopeMappingRepresentation mapping = new ScopeMappingRepresentation(); - mapping.setClientScope(clientScopeName); - if (scopeMappings == null) scopeMappings = new ArrayList<>(); - scopeMappings.add(mapping); - return mapping; - } - - @Deprecated - public Set getRequiredCredentials() { - return requiredCredentials; - } - @Deprecated - public void setRequiredCredentials(Set requiredCredentials) { - this.requiredCredentials = requiredCredentials; - } - - public String getPasswordPolicy() { - return passwordPolicy; - } - - public void setPasswordPolicy(String passwordPolicy) { - this.passwordPolicy = passwordPolicy; - } - - public Integer getAccessCodeLifespan() { - return accessCodeLifespan; - } - - public void setAccessCodeLifespan(Integer accessCodeLifespan) { - this.accessCodeLifespan = accessCodeLifespan; - } - - public Integer getAccessCodeLifespanUserAction() { - return accessCodeLifespanUserAction; - } - - public void setAccessCodeLifespanUserAction(Integer accessCodeLifespanUserAction) { - this.accessCodeLifespanUserAction = accessCodeLifespanUserAction; - } - - public Integer getAccessCodeLifespanLogin() { - return accessCodeLifespanLogin; - } - - public void setAccessCodeLifespanLogin(Integer accessCodeLifespanLogin) { - this.accessCodeLifespanLogin = accessCodeLifespanLogin; - } - - public Integer getActionTokenGeneratedByAdminLifespan() { - return actionTokenGeneratedByAdminLifespan; - } - - public void setActionTokenGeneratedByAdminLifespan(Integer actionTokenGeneratedByAdminLifespan) { - this.actionTokenGeneratedByAdminLifespan = actionTokenGeneratedByAdminLifespan; - } - - public void setOAuth2DeviceCodeLifespan(Integer oauth2DeviceCodeLifespan) { - this.oauth2DeviceCodeLifespan = oauth2DeviceCodeLifespan; - } - - public Integer getOAuth2DeviceCodeLifespan() { - return oauth2DeviceCodeLifespan; - } - - public void setOAuth2DevicePollingInterval(Integer oauth2DevicePollingInterval) { - this.oauth2DevicePollingInterval = oauth2DevicePollingInterval; - } - - public Integer getOAuth2DevicePollingInterval() { - return oauth2DevicePollingInterval; - } - - public Integer getActionTokenGeneratedByUserLifespan() { - return actionTokenGeneratedByUserLifespan; - } - - public void setActionTokenGeneratedByUserLifespan(Integer actionTokenGeneratedByUserLifespan) { - this.actionTokenGeneratedByUserLifespan = actionTokenGeneratedByUserLifespan; - } - - @Deprecated - public List getDefaultRoles() { - return defaultRoles; - } - - @Deprecated - public void setDefaultRoles(List defaultRoles) { - this.defaultRoles = defaultRoles; - } - - public RoleRepresentation getDefaultRole() { - return defaultRole; - } - - public void setDefaultRole(RoleRepresentation defaultRole) { - this.defaultRole = defaultRole; - } - - public List getDefaultGroups() { - return defaultGroups; - } - - public void setDefaultGroups(List defaultGroups) { - this.defaultGroups = defaultGroups; - } - - public String getPrivateKey() { - return privateKey; - } - - public void setPrivateKey(String privateKey) { - this.privateKey = privateKey; - } - - public String getPublicKey() { - return publicKey; - } - - public void setPublicKey(String publicKey) { - this.publicKey = publicKey; - } - - public String getCertificate() { - return certificate; - } - - public void setCertificate(String certificate) { - this.certificate = certificate; - } - - public String getCodeSecret() { - return codeSecret; - } - - public void setCodeSecret(String codeSecret) { - this.codeSecret = codeSecret; - } - - public Boolean isPasswordCredentialGrantAllowed() { - return passwordCredentialGrantAllowed; - } - - public Boolean isRegistrationAllowed() { - return registrationAllowed; - } - - public void setRegistrationAllowed(Boolean registrationAllowed) { - this.registrationAllowed = registrationAllowed; - } - - public Boolean isRegistrationEmailAsUsername() { - return registrationEmailAsUsername; - } - - public void setRegistrationEmailAsUsername(Boolean registrationEmailAsUsername) { - this.registrationEmailAsUsername = registrationEmailAsUsername; - } - - public Boolean isRememberMe() { - return rememberMe; - } - - public void setRememberMe(Boolean rememberMe) { - this.rememberMe = rememberMe; - } - - public Boolean isVerifyEmail() { - return verifyEmail; - } - - public void setVerifyEmail(Boolean verifyEmail) { - this.verifyEmail = verifyEmail; - } - - public Boolean isLoginWithEmailAllowed() { - return loginWithEmailAllowed; - } - - public void setLoginWithEmailAllowed(Boolean loginWithEmailAllowed) { - this.loginWithEmailAllowed = loginWithEmailAllowed; - } - - public Boolean isDuplicateEmailsAllowed() { - return duplicateEmailsAllowed; - } - - public void setDuplicateEmailsAllowed(Boolean duplicateEmailsAllowed) { - this.duplicateEmailsAllowed = duplicateEmailsAllowed; - } - - public Boolean isResetPasswordAllowed() { - return resetPasswordAllowed; - } - - public void setResetPasswordAllowed(Boolean resetPassword) { - this.resetPasswordAllowed = resetPassword; - } - - public Boolean isEditUsernameAllowed() { - return editUsernameAllowed; - } - - public void setEditUsernameAllowed(Boolean editUsernameAllowed) { - this.editUsernameAllowed = editUsernameAllowed; - } - - @Deprecated - public Boolean isSocial() { - return social; - } - - @Deprecated - public Boolean isUpdateProfileOnInitialSocialLogin() { - return updateProfileOnInitialSocialLogin; - } - - public Map getBrowserSecurityHeaders() { - return browserSecurityHeaders; - } - - public void setBrowserSecurityHeaders(Map browserSecurityHeaders) { - this.browserSecurityHeaders = browserSecurityHeaders; - } - - @Deprecated - public Map getSocialProviders() { - return socialProviders; - } - - public Map getSmtpServer() { - return smtpServer; - } - - public void setSmtpServer(Map smtpServer) { - this.smtpServer = smtpServer; - } - - @Deprecated - public List getOauthClients() { - return oauthClients; - } - - public Map> getClientScopeMappings() { - return clientScopeMappings; - } - - public void setClientScopeMappings(Map> clientScopeMappings) { - this.clientScopeMappings = clientScopeMappings; - } - - @Deprecated - public Map> getApplicationScopeMappings() { - return applicationScopeMappings; - } - - public RolesRepresentation getRoles() { - return roles; - } - - public void setRoles(RolesRepresentation roles) { - this.roles = roles; - } - - public String getLoginTheme() { - return loginTheme; - } - - public void setLoginTheme(String loginTheme) { - this.loginTheme = loginTheme; - } - - public String getAccountTheme() { - return accountTheme; - } - - public void setAccountTheme(String accountTheme) { - this.accountTheme = accountTheme; - } - - public String getAdminTheme() { - return adminTheme; - } - - public void setAdminTheme(String adminTheme) { - this.adminTheme = adminTheme; - } - - public String getEmailTheme() { - return emailTheme; - } - - public void setEmailTheme(String emailTheme) { - this.emailTheme = emailTheme; - } - - public Integer getNotBefore() { - return notBefore; - } - - public void setNotBefore(Integer notBefore) { - this.notBefore = notBefore; - } - - public Boolean isBruteForceProtected() { - return bruteForceProtected; - } - - public void setBruteForceProtected(Boolean bruteForceProtected) { - this.bruteForceProtected = bruteForceProtected; - } - - public Boolean isPermanentLockout() { - return permanentLockout; - } - - public void setPermanentLockout(Boolean permanentLockout) { - this.permanentLockout = permanentLockout; - } - - public Integer getMaxTemporaryLockouts() { - return maxTemporaryLockouts; - } - - public void setMaxTemporaryLockouts(Integer maxTemporaryLockouts) { - this.maxTemporaryLockouts = maxTemporaryLockouts; - } - - public Integer getMaxFailureWaitSeconds() { - return maxFailureWaitSeconds; - } - - public void setMaxFailureWaitSeconds(Integer maxFailureWaitSeconds) { - this.maxFailureWaitSeconds = maxFailureWaitSeconds; - } - - public Integer getMinimumQuickLoginWaitSeconds() { - return minimumQuickLoginWaitSeconds; - } - - public void setMinimumQuickLoginWaitSeconds(Integer minimumQuickLoginWaitSeconds) { - this.minimumQuickLoginWaitSeconds = minimumQuickLoginWaitSeconds; - } - - public Integer getWaitIncrementSeconds() { - return waitIncrementSeconds; - } - - public void setWaitIncrementSeconds(Integer waitIncrementSeconds) { - this.waitIncrementSeconds = waitIncrementSeconds; - } - - public Long getQuickLoginCheckMilliSeconds() { - return quickLoginCheckMilliSeconds; - } - - public void setQuickLoginCheckMilliSeconds(Long quickLoginCheckMilliSeconds) { - this.quickLoginCheckMilliSeconds = quickLoginCheckMilliSeconds; - } - - public Integer getMaxDeltaTimeSeconds() { - return maxDeltaTimeSeconds; - } - - public void setMaxDeltaTimeSeconds(Integer maxDeltaTimeSeconds) { - this.maxDeltaTimeSeconds = maxDeltaTimeSeconds; - } - - public Integer getFailureFactor() { - return failureFactor; - } - - public void setFailureFactor(Integer failureFactor) { - this.failureFactor = failureFactor; - } - - public Boolean isEventsEnabled() { - return eventsEnabled; - } - - public void setEventsEnabled(boolean eventsEnabled) { - this.eventsEnabled = eventsEnabled; - } - - public Long getEventsExpiration() { - return eventsExpiration; - } - - public void setEventsExpiration(long eventsExpiration) { - this.eventsExpiration = eventsExpiration; - } - - public List getEventsListeners() { - return eventsListeners; - } - - public void setEventsListeners(List eventsListeners) { - this.eventsListeners = eventsListeners; - } - - public List getEnabledEventTypes() { - return enabledEventTypes; - } - - public void setEnabledEventTypes(List enabledEventTypes) { - this.enabledEventTypes = enabledEventTypes; - } - - public Boolean isAdminEventsEnabled() { - return adminEventsEnabled; - } - - public void setAdminEventsEnabled(Boolean adminEventsEnabled) { - this.adminEventsEnabled = adminEventsEnabled; - } - - public Boolean isAdminEventsDetailsEnabled() { - return adminEventsDetailsEnabled; - } - - public void setAdminEventsDetailsEnabled(Boolean adminEventsDetailsEnabled) { - this.adminEventsDetailsEnabled = adminEventsDetailsEnabled; - } - - public List getUserFederationProviders() { - return userFederationProviders; - } - - public void setUserFederationProviders(List userFederationProviders) { - this.userFederationProviders = userFederationProviders; - } - - public List getUserFederationMappers() { - return userFederationMappers; - } - - public void setUserFederationMappers(List userFederationMappers) { - this.userFederationMappers = userFederationMappers; - } - - public void addUserFederationMapper(UserFederationMapperRepresentation userFederationMapper) { - if (userFederationMappers == null) userFederationMappers = new LinkedList<>(); - userFederationMappers.add(userFederationMapper); - } - - public List getIdentityProviders() { - return identityProviders; - } - - public void setIdentityProviders(List identityProviders) { - this.identityProviders = identityProviders; - } - - public void addIdentityProvider(IdentityProviderRepresentation identityProviderRepresentation) { - if (identityProviders == null) identityProviders = new LinkedList<>(); - identityProviders.add(identityProviderRepresentation); - } - - public List getProtocolMappers() { - return protocolMappers; - } - - public void addProtocolMapper(ProtocolMapperRepresentation rep) { - if (protocolMappers == null) protocolMappers = new LinkedList(); - protocolMappers.add(rep); - } - - public void setProtocolMappers(List protocolMappers) { - this.protocolMappers = protocolMappers; - } - - public Boolean isInternationalizationEnabled() { - return internationalizationEnabled; - } - - public void setInternationalizationEnabled(Boolean internationalizationEnabled) { - this.internationalizationEnabled = internationalizationEnabled; - } - - public Set getSupportedLocales() { - return supportedLocales; - } - - public void addSupportedLocales(String locale) { - if(supportedLocales == null){ - supportedLocales = new HashSet<>(); - } - supportedLocales.add(locale); - } - - public void setSupportedLocales(Set supportedLocales) { - this.supportedLocales = supportedLocales; - } - - public String getDefaultLocale() { - return defaultLocale; - } - - public void setDefaultLocale(String defaultLocale) { - this.defaultLocale = defaultLocale; - } - - public List getIdentityProviderMappers() { - return identityProviderMappers; - } - - public void setIdentityProviderMappers(List identityProviderMappers) { - this.identityProviderMappers = identityProviderMappers; - } - - public void addIdentityProviderMapper(IdentityProviderMapperRepresentation rep) { - if (identityProviderMappers == null) identityProviderMappers = new LinkedList<>(); - identityProviderMappers.add(rep); - } - - public List getAuthenticationFlows() { - return authenticationFlows; - } - - public void setAuthenticationFlows(List authenticationFlows) { - this.authenticationFlows = authenticationFlows; - } - - public List getAuthenticatorConfig() { - return authenticatorConfig; - } - - public void setAuthenticatorConfig(List authenticatorConfig) { - this.authenticatorConfig = authenticatorConfig; - } - - public List getRequiredActions() { - return requiredActions; - } - - public void setRequiredActions(List requiredActions) { - this.requiredActions = requiredActions; - } - - public String getOtpPolicyType() { - return otpPolicyType; - } - - public void setOtpPolicyType(String otpPolicyType) { - this.otpPolicyType = otpPolicyType; - } - - public String getOtpPolicyAlgorithm() { - return otpPolicyAlgorithm; - } - - public void setOtpPolicyAlgorithm(String otpPolicyAlgorithm) { - this.otpPolicyAlgorithm = otpPolicyAlgorithm; - } - - public Integer getOtpPolicyInitialCounter() { - return otpPolicyInitialCounter; - } - - public void setOtpPolicyInitialCounter(Integer otpPolicyInitialCounter) { - this.otpPolicyInitialCounter = otpPolicyInitialCounter; - } - - public Integer getOtpPolicyDigits() { - return otpPolicyDigits; - } - - public void setOtpPolicyDigits(Integer otpPolicyDigits) { - this.otpPolicyDigits = otpPolicyDigits; - } - - public Integer getOtpPolicyLookAheadWindow() { - return otpPolicyLookAheadWindow; - } - - public void setOtpPolicyLookAheadWindow(Integer otpPolicyLookAheadWindow) { - this.otpPolicyLookAheadWindow = otpPolicyLookAheadWindow; - } - - public Integer getOtpPolicyPeriod() { - return otpPolicyPeriod; - } - - public void setOtpPolicyPeriod(Integer otpPolicyPeriod) { - this.otpPolicyPeriod = otpPolicyPeriod; - } - - public List getOtpSupportedApplications() { - return otpSupportedApplications; - } - - public void setOtpSupportedApplications(List otpSupportedApplications) { - this.otpSupportedApplications = otpSupportedApplications; - } - - public Map> getLocalizationTexts() { - return localizationTexts; - } - - public void setLocalizationTexts(Map> localizationTexts) { - this.localizationTexts = localizationTexts; - } - - public Boolean isOtpPolicyCodeReusable() { - return otpPolicyCodeReusable; - } - - public void setOtpPolicyCodeReusable(Boolean isCodeReusable) { - this.otpPolicyCodeReusable = isCodeReusable; - } - - // WebAuthn 2-factor properties below - - public String getWebAuthnPolicyRpEntityName() { - return webAuthnPolicyRpEntityName; - } - - public void setWebAuthnPolicyRpEntityName(String webAuthnPolicyRpEntityName) { - this.webAuthnPolicyRpEntityName = webAuthnPolicyRpEntityName; - } - - public List getWebAuthnPolicySignatureAlgorithms() { - return webAuthnPolicySignatureAlgorithms; - } - - public void setWebAuthnPolicySignatureAlgorithms(List webAuthnPolicySignatureAlgorithms) { - this.webAuthnPolicySignatureAlgorithms = webAuthnPolicySignatureAlgorithms; - } - - public String getWebAuthnPolicyRpId() { - return webAuthnPolicyRpId; - } - - public void setWebAuthnPolicyRpId(String webAuthnPolicyRpId) { - this.webAuthnPolicyRpId = webAuthnPolicyRpId; - } - - public String getWebAuthnPolicyAttestationConveyancePreference() { - return webAuthnPolicyAttestationConveyancePreference; - } - - public void setWebAuthnPolicyAttestationConveyancePreference(String webAuthnPolicyAttestationConveyancePreference) { - this.webAuthnPolicyAttestationConveyancePreference = webAuthnPolicyAttestationConveyancePreference; - } - - public String getWebAuthnPolicyAuthenticatorAttachment() { - return webAuthnPolicyAuthenticatorAttachment; - } - - public void setWebAuthnPolicyAuthenticatorAttachment(String webAuthnPolicyAuthenticatorAttachment) { - this.webAuthnPolicyAuthenticatorAttachment = webAuthnPolicyAuthenticatorAttachment; - } - - public String getWebAuthnPolicyRequireResidentKey() { - return webAuthnPolicyRequireResidentKey; - } - - public void setWebAuthnPolicyRequireResidentKey(String webAuthnPolicyRequireResidentKey) { - this.webAuthnPolicyRequireResidentKey = webAuthnPolicyRequireResidentKey; - } - - public String getWebAuthnPolicyUserVerificationRequirement() { - return webAuthnPolicyUserVerificationRequirement; - } - - public void setWebAuthnPolicyUserVerificationRequirement(String webAuthnPolicyUserVerificationRequirement) { - this.webAuthnPolicyUserVerificationRequirement = webAuthnPolicyUserVerificationRequirement; - } - - public Integer getWebAuthnPolicyCreateTimeout() { - return webAuthnPolicyCreateTimeout; - } - - public void setWebAuthnPolicyCreateTimeout(Integer webAuthnPolicyCreateTimeout) { - this.webAuthnPolicyCreateTimeout = webAuthnPolicyCreateTimeout; - } - - public Boolean isWebAuthnPolicyAvoidSameAuthenticatorRegister() { - return webAuthnPolicyAvoidSameAuthenticatorRegister; - } - - public void setWebAuthnPolicyAvoidSameAuthenticatorRegister(Boolean webAuthnPolicyAvoidSameAuthenticatorRegister) { - this.webAuthnPolicyAvoidSameAuthenticatorRegister = webAuthnPolicyAvoidSameAuthenticatorRegister; - } - - public List getWebAuthnPolicyAcceptableAaguids() { - return webAuthnPolicyAcceptableAaguids; - } - - public void setWebAuthnPolicyAcceptableAaguids(List webAuthnPolicyAcceptableAaguids) { - this.webAuthnPolicyAcceptableAaguids = webAuthnPolicyAcceptableAaguids; - } - - public List getWebAuthnPolicyExtraOrigins(){ - return webAuthnPolicyExtraOrigins; - } - - public void setWebAuthnPolicyExtraOrigins(List extraOrigins) { - this.webAuthnPolicyExtraOrigins = extraOrigins; - } - - // WebAuthn passwordless properties below - - - public String getWebAuthnPolicyPasswordlessRpEntityName() { - return webAuthnPolicyPasswordlessRpEntityName; - } - - public void setWebAuthnPolicyPasswordlessRpEntityName(String webAuthnPolicyPasswordlessRpEntityName) { - this.webAuthnPolicyPasswordlessRpEntityName = webAuthnPolicyPasswordlessRpEntityName; - } - - public List getWebAuthnPolicyPasswordlessSignatureAlgorithms() { - return webAuthnPolicyPasswordlessSignatureAlgorithms; - } - - public void setWebAuthnPolicyPasswordlessSignatureAlgorithms(List webAuthnPolicyPasswordlessSignatureAlgorithms) { - this.webAuthnPolicyPasswordlessSignatureAlgorithms = webAuthnPolicyPasswordlessSignatureAlgorithms; - } - - public String getWebAuthnPolicyPasswordlessRpId() { - return webAuthnPolicyPasswordlessRpId; - } - - public void setWebAuthnPolicyPasswordlessRpId(String webAuthnPolicyPasswordlessRpId) { - this.webAuthnPolicyPasswordlessRpId = webAuthnPolicyPasswordlessRpId; - } - - public String getWebAuthnPolicyPasswordlessAttestationConveyancePreference() { - return webAuthnPolicyPasswordlessAttestationConveyancePreference; - } - - public void setWebAuthnPolicyPasswordlessAttestationConveyancePreference(String webAuthnPolicyPasswordlessAttestationConveyancePreference) { - this.webAuthnPolicyPasswordlessAttestationConveyancePreference = webAuthnPolicyPasswordlessAttestationConveyancePreference; - } - - public String getWebAuthnPolicyPasswordlessAuthenticatorAttachment() { - return webAuthnPolicyPasswordlessAuthenticatorAttachment; - } - - public void setWebAuthnPolicyPasswordlessAuthenticatorAttachment(String webAuthnPolicyPasswordlessAuthenticatorAttachment) { - this.webAuthnPolicyPasswordlessAuthenticatorAttachment = webAuthnPolicyPasswordlessAuthenticatorAttachment; - } - - public String getWebAuthnPolicyPasswordlessRequireResidentKey() { - return webAuthnPolicyPasswordlessRequireResidentKey; - } - - public void setWebAuthnPolicyPasswordlessRequireResidentKey(String webAuthnPolicyPasswordlessRequireResidentKey) { - this.webAuthnPolicyPasswordlessRequireResidentKey = webAuthnPolicyPasswordlessRequireResidentKey; - } - - public String getWebAuthnPolicyPasswordlessUserVerificationRequirement() { - return webAuthnPolicyPasswordlessUserVerificationRequirement; - } - - public void setWebAuthnPolicyPasswordlessUserVerificationRequirement(String webAuthnPolicyPasswordlessUserVerificationRequirement) { - this.webAuthnPolicyPasswordlessUserVerificationRequirement = webAuthnPolicyPasswordlessUserVerificationRequirement; - } - - public Integer getWebAuthnPolicyPasswordlessCreateTimeout() { - return webAuthnPolicyPasswordlessCreateTimeout; - } - - public void setWebAuthnPolicyPasswordlessCreateTimeout(Integer webAuthnPolicyPasswordlessCreateTimeout) { - this.webAuthnPolicyPasswordlessCreateTimeout = webAuthnPolicyPasswordlessCreateTimeout; - } - - public Boolean isWebAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister() { - return webAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister; - } - - public void setWebAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister(Boolean webAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister) { - this.webAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister = webAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister; - } - - public List getWebAuthnPolicyPasswordlessAcceptableAaguids() { - return webAuthnPolicyPasswordlessAcceptableAaguids; - } - - public void setWebAuthnPolicyPasswordlessAcceptableAaguids(List webAuthnPolicyPasswordlessAcceptableAaguids) { - this.webAuthnPolicyPasswordlessAcceptableAaguids = webAuthnPolicyPasswordlessAcceptableAaguids; - } - - public List getWebAuthnPolicyPasswordlessExtraOrigins(){ - return webAuthnPolicyPasswordlessExtraOrigins; - } - - public void setWebAuthnPolicyPasswordlessExtraOrigins(List extraOrigins) { - this.webAuthnPolicyPasswordlessExtraOrigins = extraOrigins; - } - - // Client Policies/Profiles - - @JsonIgnore - public ClientProfilesRepresentation getParsedClientProfiles() { - try { - if (clientProfiles == null) return null; - return JsonSerialization.mapper.convertValue(clientProfiles, ClientProfilesRepresentation.class); - } catch (IllegalArgumentException ioe) { - logger.warnf("Failed to deserialize client profiles in the realm %s. Fallback to return empty profiles. Details: %s", realm, ioe.getMessage()); - return null; - } - } - - @JsonIgnore - public void setParsedClientProfiles(ClientProfilesRepresentation clientProfiles) { - if (clientProfiles == null) { - this.clientProfiles = null; - return; - } - this.clientProfiles = JsonSerialization.mapper.convertValue(clientProfiles, JsonNode.class); - } - - @JsonIgnore - public ClientPoliciesRepresentation getParsedClientPolicies() { - try { - if (clientPolicies == null) return null; - return JsonSerialization.mapper.convertValue(clientPolicies, ClientPoliciesRepresentation.class); - } catch (IllegalArgumentException ioe) { - logger.warnf("Failed to deserialize client policies in the realm %s. Fallback to return empty profiles. Details: %s", realm, ioe.getMessage()); - return null; - } - } - - @JsonIgnore - public void setParsedClientPolicies(ClientPoliciesRepresentation clientPolicies) { - if (clientPolicies == null) { - this.clientPolicies = null; - return; - } - this.clientPolicies = JsonSerialization.mapper.convertValue(clientPolicies, JsonNode.class); - } - - public String getBrowserFlow() { - return browserFlow; - } - - public void setBrowserFlow(String browserFlow) { - this.browserFlow = browserFlow; - } - - public String getRegistrationFlow() { - return registrationFlow; - } - - public void setRegistrationFlow(String registrationFlow) { - this.registrationFlow = registrationFlow; - } - - public String getDirectGrantFlow() { - return directGrantFlow; - } - - public void setDirectGrantFlow(String directGrantFlow) { - this.directGrantFlow = directGrantFlow; - } - - public String getResetCredentialsFlow() { - return resetCredentialsFlow; - } - - public void setResetCredentialsFlow(String resetCredentialsFlow) { - this.resetCredentialsFlow = resetCredentialsFlow; - } - - public String getClientAuthenticationFlow() { - return clientAuthenticationFlow; - } - - public void setClientAuthenticationFlow(String clientAuthenticationFlow) { - this.clientAuthenticationFlow = clientAuthenticationFlow; - } - - public String getDockerAuthenticationFlow() { - return dockerAuthenticationFlow; - } - - public RealmRepresentation setDockerAuthenticationFlow(final String dockerAuthenticationFlow) { - this.dockerAuthenticationFlow = dockerAuthenticationFlow; - return this; - } - - public String getFirstBrokerLoginFlow() { - return firstBrokerLoginFlow; - } - - public RealmRepresentation setFirstBrokerLoginFlow(String firstBrokerLoginFlow) { - this.firstBrokerLoginFlow = firstBrokerLoginFlow; - return this; - } - - public String getKeycloakVersion() { - return keycloakVersion; - } - - public void setKeycloakVersion(String keycloakVersion) { - this.keycloakVersion = keycloakVersion; - } - - public List getGroups() { - return groups; - } - - public void setGroups(List groups) { - this.groups = groups; - } - - @Deprecated // use getClientScopes() instead - public List getClientTemplates() { - return clientTemplates; - } - - public List getClientScopes() { - return clientScopes; - } - - public void setClientScopes(List clientScopes) { - this.clientScopes = clientScopes; - } - - public List getDefaultDefaultClientScopes() { - return defaultDefaultClientScopes; - } - - public void setDefaultDefaultClientScopes(List defaultDefaultClientScopes) { - this.defaultDefaultClientScopes = defaultDefaultClientScopes; - } - - public List getDefaultOptionalClientScopes() { - return defaultOptionalClientScopes; - } - - public void setDefaultOptionalClientScopes(List defaultOptionalClientScopes) { - this.defaultOptionalClientScopes = defaultOptionalClientScopes; - } - - public MultivaluedHashMap getComponents() { - return components; - } - - public void setComponents(MultivaluedHashMap components) { - this.components = components; - } - - @JsonIgnore - public boolean isIdentityFederationEnabled() { - return identityProviders != null && !identityProviders.isEmpty(); - } - - public void setAttributes(Map attributes) { - this.attributes = attributes; - } - - public Map getAttributes() { - return attributes; - } - - public List getFederatedUsers() { - return federatedUsers; - } - - public void setFederatedUsers(List federatedUsers) { - this.federatedUsers = federatedUsers; - } - - public void setUserManagedAccessAllowed(Boolean userManagedAccessAllowed) { - this.userManagedAccessAllowed = userManagedAccessAllowed; - } - - public Boolean isUserManagedAccessAllowed() { - return userManagedAccessAllowed; - } - - public Boolean isOrganizationsEnabled() { - return organizationsEnabled; - } - - public void setOrganizationsEnabled(Boolean organizationsEnabled) { - this.organizationsEnabled = organizationsEnabled; - } - - @JsonIgnore - public Map getAttributesOrEmpty() { - return (Map) (attributes == null ? Collections.emptyMap() : attributes); - } - - public List getOrganizations() { - return organizations; - } - - public void setOrganizations(List organizations) { - this.organizations = organizations; - } - - public void addOrganization(OrganizationRepresentation org) { - if (organizations == null) { - organizations = new ArrayList<>(); - } - organizations.add(org); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/RequiredActionConfigInfoRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/RequiredActionConfigInfoRepresentation.java deleted file mode 100644 index 856ff92..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/RequiredActionConfigInfoRepresentation.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2024 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; - -/** - * Represents the configurable properties of a RequiredAction. - */ -public class RequiredActionConfigInfoRepresentation { - - private List properties; - - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } -} - diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/RequiredActionConfigRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/RequiredActionConfigRepresentation.java deleted file mode 100755 index eb7a31d..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/RequiredActionConfigRepresentation.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2024 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -/** - * Represents the configuration of a RequiredAction. - */ -public class RequiredActionConfigRepresentation implements Serializable { - - private Map config = new HashMap<>(); - - public Map getConfig() { - return config; - } - - public void setConfig(Map config) { - this.config = config; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/RequiredActionProviderRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/RequiredActionProviderRepresentation.java deleted file mode 100755 index 74d7768..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/RequiredActionProviderRepresentation.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.Map; - -/** -* @author Bill Burke -* @version $Revision: 1 $ -*/ -public class RequiredActionProviderRepresentation { - - private String alias; - private String name; - private String providerId; - private boolean enabled; - private boolean defaultAction; - private int priority; - private Map config; - - public String getAlias() { - return alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } - - /** - * Used for display purposes. Probably should clean this code up and make alias and name the same, but - * the old code references an Enum and the admin console creates a "friendly" name for each enum. - * - * @return - */ - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public boolean isDefaultAction() { - return defaultAction; - } - - public void setDefaultAction(boolean defaultAction) { - this.defaultAction = defaultAction; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public int getPriority() { - return priority; - } - - public void setPriority(int priority) { - this.priority = priority; - } - - public Map getConfig() { - return config; - } - - public void setConfig(Map config) { - this.config = config; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/RequiredActionProviderSimpleRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/RequiredActionProviderSimpleRepresentation.java deleted file mode 100644 index 88092ef..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/RequiredActionProviderSimpleRepresentation.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * Some endpoints (like register new required action) doesn't support all the fields (like setEnabled etc). - * So this is just simplified version of full RequiredActionProviderRepresentation - * - * @author Marek Posolda - */ -public class RequiredActionProviderSimpleRepresentation { - - private String id; - private String name; - private String providerId; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/RoleRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/RoleRepresentation.java deleted file mode 100755 index 5302c51..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/RoleRepresentation.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class RoleRepresentation { - protected String id; - protected String name; - protected String description; - @Deprecated - protected Boolean scopeParamRequired; - protected boolean composite; - protected Composites composites; - private Boolean clientRole; - private String containerId; - protected Map> attributes; - - public static class Composites { - protected Set realm; - protected Map> client; - @Deprecated - protected Map> application; - - public Set getRealm() { - return realm; - } - - public void setRealm(Set realm) { - this.realm = realm; - } - - public Map> getClient() { - return client; - } - - public void setClient(Map> client) { - this.client = client; - } - - @Deprecated - public Map> getApplication() { - return application; - } - } - - public RoleRepresentation() { - } - - public RoleRepresentation(String name, String description, boolean scopeParamRequired) { - this.name = name; - this.description = description; - this.scopeParamRequired = scopeParamRequired; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @Deprecated - public Boolean isScopeParamRequired() { - return scopeParamRequired; - } - - public Composites getComposites() { - return composites; - } - - public void setComposites(Composites composites) { - this.composites = composites; - } - - @Override - public String toString() { - return name; - } - - public boolean isComposite() { - return composite; - } - - public void setComposite(boolean composite) { - this.composite = composite; - } - - public Boolean getClientRole() { - return clientRole; - } - - public void setClientRole(Boolean clientRole) { - this.clientRole = clientRole; - } - - public String getContainerId() { - return containerId; - } - - public void setContainerId(String containerId) { - this.containerId = containerId; - } - - public Map> getAttributes() { - return attributes; - } - - public void setAttributes(Map> attributes) { - this.attributes = attributes; - } - - public RoleRepresentation singleAttribute(String name, String value) { - if (attributes == null) { - attributes = new HashMap<>(); - } - - attributes.put(name, Arrays.asList(value)); - return this; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 29 * hash + Objects.hashCode(this.id); - hash = 29 * hash + Objects.hashCode(this.name); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || (!(obj instanceof RoleRepresentation))) { - return false; - } - final RoleRepresentation other = (RoleRepresentation) obj; - return Objects.equals(this.id, other.id) && Objects.equals(this.name, other.name); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/RolesRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/RolesRepresentation.java deleted file mode 100755 index fdcbbbe..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/RolesRepresentation.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; -import java.util.Map; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class RolesRepresentation { - protected List realm; - protected Map> client; - @Deprecated - protected Map> application; - - public List getRealm() { - return realm; - } - - public void setRealm(List realm) { - this.realm = realm; - } - - public Map> getClient() { - return client; - } - - public void setClient(Map> client) { - this.client = client; - } - - @Deprecated - public Map> getApplication() { - return application; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/ScopeMappingRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/ScopeMappingRepresentation.java deleted file mode 100755 index 42397fd..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/ScopeMappingRepresentation.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.HashSet; -import java.util.Set; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class ScopeMappingRepresentation { - protected String self; // link - protected String client; - - @Deprecated // Replaced by clientScope - protected String clientTemplate; - protected String clientScope; - protected Set roles; - - public String getSelf() { - return self; - } - - public void setSelf(String self) { - this.self = self; - } - - public String getClient() { - return client; - } - - public void setClient(String client) { - this.client = client; - } - - @Deprecated - public String getClientTemplate() { - return clientTemplate; - } - - public String getClientScope() { - return clientScope; - } - - public void setClientScope(String clientScope) { - this.clientScope = clientScope; - } - - public Set getRoles() { - return roles; - } - - public void setRoles(Set roles) { - this.roles = roles; - } - - public ScopeMappingRepresentation role(String role) { - if (this.roles == null) this.roles = new HashSet<>(); - this.roles.add(role); - return this; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/SecurityProfileConfiguration.java b/authz-client/src/main/java/org/keycloak/representations/idm/SecurityProfileConfiguration.java deleted file mode 100644 index 0da5f06..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/SecurityProfileConfiguration.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2024 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** - * Default configuration for security profile. For the moment just a name and pointers - * to default global client profiles and policies. - * - * @author rmartinc - */ -public class SecurityProfileConfiguration { - - private String name; - @JsonProperty("client-profiles") - private String clientProfiles; - @JsonProperty("client-policies") - private String clientPolicies; - @JsonIgnore - private List defaultClientProfiles; - @JsonIgnore - private List defaultClientPolicies; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getClientProfiles() { - return clientProfiles; - } - - public void setClientProfiles(String clientProfiles) { - this.clientProfiles = clientProfiles; - } - - public String getClientPolicies() { - return clientPolicies; - } - - public void setClientPolicies(String clientPolicies) { - this.clientPolicies = clientPolicies; - } - - public List getDefaultClientProfiles() { - return defaultClientProfiles; - } - - public void setDefaultClientProfiles(List defaultClientProfiles) { - this.defaultClientProfiles = defaultClientProfiles; - } - - public List getDefaultClientPolicies() { - return defaultClientPolicies; - } - - public void setDefaultClientPolicies(List defaultClientPolicies) { - this.defaultClientPolicies = defaultClientPolicies; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/SocialLinkRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/SocialLinkRepresentation.java deleted file mode 100644 index d68e6fe..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/SocialLinkRepresentation.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * @author Marek Posolda - */ -public class SocialLinkRepresentation { - - protected String socialProvider; - protected String socialUserId; - protected String socialUsername; - - public String getSocialProvider() { - return socialProvider; - } - - public void setSocialProvider(String socialProvider) { - this.socialProvider = socialProvider; - } - - public String getSocialUserId() { - return socialUserId; - } - - public void setSocialUserId(String socialUserId) { - this.socialUserId = socialUserId; - } - - public String getSocialUsername() { - return socialUsername; - } - - public void setSocialUsername(String socialUsername) { - this.socialUsername = socialUsername; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/SynchronizationResultRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/SynchronizationResultRepresentation.java deleted file mode 100644 index dd17dfa..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/SynchronizationResultRepresentation.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * @author Marek Posolda - */ -public class SynchronizationResultRepresentation { - - private boolean ignored; - - private int added; - private int updated; - private int removed; - private int failed; - - private String status; - - public SynchronizationResultRepresentation() { - } - - public boolean isIgnored() { - return ignored; - } - - public void setIgnored(boolean ignored) { - this.ignored = ignored; - } - - public int getAdded() { - return added; - } - - public void setAdded(int added) { - this.added = added; - } - - public int getUpdated() { - return updated; - } - - public void setUpdated(int updated) { - this.updated = updated; - } - - public int getRemoved() { - return removed; - } - - public void setRemoved(int removed) { - this.removed = removed; - } - - public int getFailed() { - return failed; - } - - public void setFailed(int failed) { - this.failed = failed; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/TestLdapConnectionRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/TestLdapConnectionRepresentation.java deleted file mode 100644 index 715ac6f..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/TestLdapConnectionRepresentation.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.keycloak.representations.idm; - -public class TestLdapConnectionRepresentation { - - private String action; - private String connectionUrl; - private String bindDn; - private String bindCredential; - private String useTruststoreSpi; - private String connectionTimeout; - private String componentId; - private String startTls; - private String authType; - - public TestLdapConnectionRepresentation() { - } - - public TestLdapConnectionRepresentation(String action, String connectionUrl, String bindDn, String bindCredential, String useTruststoreSpi, String connectionTimeout) { - this(action, connectionUrl, bindDn, bindCredential, useTruststoreSpi, connectionTimeout, null, null, null); - } - - public TestLdapConnectionRepresentation(String action, String connectionUrl, String bindDn, String bindCredential, String useTruststoreSpi, String connectionTimeout, String startTls, String authType) { - this(action, connectionUrl, bindDn, bindCredential, useTruststoreSpi, connectionTimeout, startTls, authType, null); - } - - public TestLdapConnectionRepresentation(String action, String connectionUrl, String bindDn, String bindCredential, - String useTruststoreSpi, String connectionTimeout, String startTls, String authType, String componentId) { - this.action = action; - this.connectionUrl = connectionUrl; - this.bindDn = bindDn; - this.bindCredential = bindCredential; - this.useTruststoreSpi = useTruststoreSpi; - this.connectionTimeout = connectionTimeout; - this.startTls = startTls; - this.authType = authType; - this.componentId = componentId; - } - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public String getConnectionUrl() { - return connectionUrl; - } - - public void setConnectionUrl(String connectionUrl) { - this.connectionUrl = connectionUrl; - } - - public String getAuthType() { - return authType; - } - - public void setAuthType(String authType) { - this.authType = authType; - } - - public String getBindDn() { - return bindDn; - } - - public void setBindDn(String bindDn) { - this.bindDn = bindDn; - } - - public String getBindCredential() { - return bindCredential; - } - - public void setBindCredential(String bindCredential) { - this.bindCredential = bindCredential; - } - - public String getUseTruststoreSpi() { - return useTruststoreSpi; - } - - public void setUseTruststoreSpi(String useTruststoreSpi) { - this.useTruststoreSpi = useTruststoreSpi; - } - - public String getConnectionTimeout() { - return connectionTimeout; - } - - public void setConnectionTimeout(String connectionTimeout) { - this.connectionTimeout = connectionTimeout; - } - - public String getComponentId() { - return componentId; - } - - public void setComponentId(String componentId) { - this.componentId = componentId; - } - - public String getStartTls() { - return startTls; - } - - public void setStartTls(String startTls) { - this.startTls = startTls; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/UserConsentRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/UserConsentRepresentation.java deleted file mode 100644 index 17dbe6c..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/UserConsentRepresentation.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -/** - * @author Marek Posolda - */ -@JsonIgnoreProperties(ignoreUnknown=true) -public class UserConsentRepresentation { - - protected String clientId; - - protected List grantedClientScopes; - - private Long createdDate; - - private Long lastUpdatedDate; - - @Deprecated - protected List grantedRealmRoles; - - public String getClientId() { - return clientId; - } - - public void setClientId(String clientId) { - this.clientId = clientId; - } - - public List getGrantedClientScopes() { - return grantedClientScopes; - } - - public void setGrantedClientScopes(List grantedClientScopes) { - this.grantedClientScopes = grantedClientScopes; - } - - public void setCreatedDate(Long createdDate) { - this.createdDate = createdDate; - } - - public Long getCreatedDate() { - return createdDate; - } - - public void setLastUpdatedDate(Long lastUpdatedDate) { - this.lastUpdatedDate = lastUpdatedDate; - } - - public Long getLastUpdatedDate() { - return lastUpdatedDate; - } - - @Deprecated - public List getGrantedRealmRoles() { - return grantedRealmRoles; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperRepresentation.java deleted file mode 100644 index 045cc9b..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperRepresentation.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.Map; - -/** - * @author Marek Posolda - */ -public class UserFederationMapperRepresentation { - - protected String id; - protected String name; - protected String federationProviderDisplayName; - protected String federationMapperType; - protected Map config; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getFederationProviderDisplayName() { - return federationProviderDisplayName; - } - - public void setFederationProviderDisplayName(String federationProviderDisplayName) { - this.federationProviderDisplayName = federationProviderDisplayName; - } - - public String getFederationMapperType() { - return federationMapperType; - } - - public void setFederationMapperType(String federationMapperType) { - this.federationMapperType = federationMapperType; - } - - public Map getConfig() { - return config; - } - - public void setConfig(Map config) { - this.config = config; - } -} - diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperSyncConfigRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperSyncConfigRepresentation.java deleted file mode 100644 index 96538f4..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperSyncConfigRepresentation.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -/** - * @author Marek Posolda - */ -public class UserFederationMapperSyncConfigRepresentation { - - private Boolean fedToKeycloakSyncSupported; - private String fedToKeycloakSyncMessage; // applicable just if fedToKeycloakSyncSupported is true - - private Boolean keycloakToFedSyncSupported; - private String keycloakToFedSyncMessage; // applicable just if keycloakToFedSyncSupported is true - - public UserFederationMapperSyncConfigRepresentation() { - } - - public UserFederationMapperSyncConfigRepresentation(boolean fedToKeycloakSyncSupported, String fedToKeycloakSyncMessage, - boolean keycloakToFedSyncSupported, String keycloakToFedSyncMessage) { - this.fedToKeycloakSyncSupported = fedToKeycloakSyncSupported; - this.fedToKeycloakSyncMessage = fedToKeycloakSyncMessage; - this.keycloakToFedSyncSupported = keycloakToFedSyncSupported; - this.keycloakToFedSyncMessage = keycloakToFedSyncMessage; - } - - public Boolean isFedToKeycloakSyncSupported() { - return fedToKeycloakSyncSupported; - } - - public void setFedToKeycloakSyncSupported(Boolean fedToKeycloakSyncSupported) { - this.fedToKeycloakSyncSupported = fedToKeycloakSyncSupported; - } - - public String getFedToKeycloakSyncMessage() { - return fedToKeycloakSyncMessage; - } - - public void setFedToKeycloakSyncMessage(String fedToKeycloakSyncMessage) { - this.fedToKeycloakSyncMessage = fedToKeycloakSyncMessage; - } - - public Boolean isKeycloakToFedSyncSupported() { - return keycloakToFedSyncSupported; - } - - public void setKeycloakToFedSyncSupported(Boolean keycloakToFedSyncSupported) { - this.keycloakToFedSyncSupported = keycloakToFedSyncSupported; - } - - public String getKeycloakToFedSyncMessage() { - return keycloakToFedSyncMessage; - } - - public void setKeycloakToFedSyncMessage(String keycloakToFedSyncMessage) { - this.keycloakToFedSyncMessage = keycloakToFedSyncMessage; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperTypeRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperTypeRepresentation.java deleted file mode 100644 index e349812..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperTypeRepresentation.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -/** - * @author Marek Posolda - */ -public class UserFederationMapperTypeRepresentation { - protected String id; - protected String name; - protected String category; - protected String helpText; - - protected UserFederationMapperSyncConfigRepresentation syncConfig; - protected List properties = new LinkedList<>(); - protected Map defaultConfig = new HashMap<>(); - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getHelpText() { - return helpText; - } - - public void setHelpText(String helpText) { - this.helpText = helpText; - } - - public UserFederationMapperSyncConfigRepresentation getSyncConfig() { - return syncConfig; - } - - public void setSyncConfig(UserFederationMapperSyncConfigRepresentation syncConfig) { - this.syncConfig = syncConfig; - } - - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } - - public Map getDefaultConfig() { - return defaultConfig; - } - - public void setDefaultConfig(Map defaultConfig) { - this.defaultConfig = defaultConfig; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationProviderFactoryRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationProviderFactoryRepresentation.java deleted file mode 100755 index bbf5741..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationProviderFactoryRepresentation.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; -import java.util.Set; - -/** - * @author Bill Burke - */ -public class UserFederationProviderFactoryRepresentation { - - private String id; - private Set options; // TODO:Remove as configurable providers are more flexible? - private String helpText; // Used for configurable providers - private List properties; // Used for configurable providers - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Set getOptions() { - return options; - } - - public void setOptions(Set options) { - this.options = options; - } - - public String getHelpText() { - return helpText; - } - - public void setHelpText(String helpText) { - this.helpText = helpText; - } - - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - UserFederationProviderFactoryRepresentation that = (UserFederationProviderFactoryRepresentation) o; - - if (!id.equals(that.id)) return false; - - return true; - } - - @Override - public int hashCode() { - return id.hashCode(); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationProviderRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationProviderRepresentation.java deleted file mode 100755 index ff53305..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/UserFederationProviderRepresentation.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.Map; - -/** - * @author Marek Posolda - */ -public class UserFederationProviderRepresentation { - - private String id; - private String displayName; - private String providerName; - private Map config; - private int priority; - private int fullSyncPeriod; - private int changedSyncPeriod; - private int lastSync; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public String getProviderName() { - return providerName; - } - - public void setProviderName(String providerName) { - this.providerName = providerName; - } - - - public Map getConfig() { - return config; - } - - public void setConfig(Map config) { - this.config = config; - } - - public int getPriority() { - return priority; - } - - public void setPriority(int priority) { - this.priority = priority; - } - - public int getFullSyncPeriod() { - return fullSyncPeriod; - } - - public void setFullSyncPeriod(int fullSyncPeriod) { - this.fullSyncPeriod = fullSyncPeriod; - } - - public int getChangedSyncPeriod() { - return changedSyncPeriod; - } - - public void setChangedSyncPeriod(int changedSyncPeriod) { - this.changedSyncPeriod = changedSyncPeriod; - } - - public int getLastSync() { - return lastSync; - } - - public void setLastSync(int lastSync) { - this.lastSync = lastSync; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - UserFederationProviderRepresentation that = (UserFederationProviderRepresentation) o; - - if (!id.equals(that.id)) return false; - - return true; - } - - @Override - public int hashCode() { - return id.hashCode(); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/UserProfileAttributeGroupMetadata.java b/authz-client/src/main/java/org/keycloak/representations/idm/UserProfileAttributeGroupMetadata.java deleted file mode 100644 index 2462e38..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/UserProfileAttributeGroupMetadata.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm; - -import java.util.Map; - -public class UserProfileAttributeGroupMetadata { - - private String name; - private String displayHeader; - private String displayDescription; - private Map annotations; - - public UserProfileAttributeGroupMetadata() { - } - - public UserProfileAttributeGroupMetadata(String name, String displayHeader, String displayDescription, Map annotations) { - this.name = name; - this.displayHeader = displayHeader; - this.displayDescription = displayDescription; - this.annotations = annotations; - } - - public String getName() { - return name; - } - - public String getDisplayHeader() { - return displayHeader; - } - - - public String getDisplayDescription() { - return displayDescription; - } - - public Map getAnnotations() { - return annotations; - } -} \ No newline at end of file diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/UserProfileAttributeMetadata.java b/authz-client/src/main/java/org/keycloak/representations/idm/UserProfileAttributeMetadata.java deleted file mode 100644 index 2911ab7..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/UserProfileAttributeMetadata.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm; - -import java.util.Map; - -/** - * @author Vlastimil Elias - */ -public class UserProfileAttributeMetadata { - - private String name; - private String displayName; - private boolean required; - private boolean readOnly; - private Map annotations; - private Map> validators; - private String group; - private boolean multivalued; - - public UserProfileAttributeMetadata() { - - } - - public UserProfileAttributeMetadata(String name, String displayName, boolean required, boolean readOnly, String group, Map annotations, - Map> validators, boolean multivalued) { - this.name = name; - this.displayName = displayName; - this.required = required; - this.readOnly = readOnly; - this.annotations = annotations; - this.validators = validators; - this.group = group; - this.multivalued = multivalued; - } - - public String getName() { - return name; - } - - /** - * @return display name, either direct string to display, or construct for i18n like ${i18nkey} - */ - public String getDisplayName() { - return displayName; - } - - public boolean isRequired() { - return required; - } - - public boolean isReadOnly() { - return readOnly; - } - - public String getGroup() { - return group; - } - - /** - * Get info about attribute annotations loaded from UserProfile configuration. - */ - public Map getAnnotations() { - return annotations; - } - - /** - * Get info about validators applied to attribute. - * - * @return map where key is validatorId and value is map with configuration for given validator (loaded from UserProfile configuration) - */ - public Map> getValidators() { - return validators; - } - - public void setMultivalued(boolean multivalued) { - this.multivalued = multivalued; - } - - public boolean isMultivalued() { - return multivalued; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/UserProfileMetadata.java b/authz-client/src/main/java/org/keycloak/representations/idm/UserProfileMetadata.java deleted file mode 100644 index 13e2fd7..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/UserProfileMetadata.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm; - -import static java.util.Collections.emptyList; - -import java.util.List; -import java.util.Optional; - -/** - * @author Vlastimil Elias - */ -public class UserProfileMetadata { - - private List attributes; - private List groups; - - public UserProfileMetadata() { - - } - - public UserProfileMetadata(List attributes, List groups) { - super(); - this.attributes = attributes; - this.groups = groups; - } - - public List getAttributes() { - return attributes; - } - - public List getGroups() { - return groups; - } - - public void setAttributes(List attributes) { - this.attributes = attributes; - } - - public UserProfileAttributeMetadata getAttributeMetadata(String name) { - for (UserProfileAttributeMetadata m : Optional.ofNullable(getAttributes()).orElse(emptyList())) { - if (m.getName().equals(name)) { - return m; - } - } - - return null; - } - - public UserProfileAttributeGroupMetadata getAttributeGroupMetadata(String name) { - for (UserProfileAttributeGroupMetadata m : Optional.ofNullable(getGroups()).orElse(emptyList())) { - if (m.getName().equals(name)) { - return m; - } - } - - return null; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/UserRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/UserRepresentation.java deleted file mode 100755 index a4e5ed0..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/UserRepresentation.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class UserRepresentation extends AbstractUserRepresentation{ - - protected String self; // link - protected String origin; - protected Long createdTimestamp; - protected Boolean enabled; - protected Boolean totp; - protected String federationLink; - protected String serviceAccountClientId; // For rep, it points to clientId (not DB ID) - - protected List credentials; - protected Set disableableCredentialTypes; - protected List requiredActions; - protected List federatedIdentities; - protected List realmRoles; - protected Map> clientRoles; - protected List clientConsents; - protected Integer notBefore; - - @Deprecated - protected Map> applicationRoles; - @Deprecated - protected List socialLinks; - - protected List groups; - private Map access; - - public UserRepresentation() { - } - - public UserRepresentation(UserRepresentation rep) { - // AbstractUserRepresentation - this.id = rep.getId(); - this.username = rep.getUsername(); - this.firstName = rep.getFirstName(); - this.lastName = rep.getLastName(); - this.email = rep.getEmail(); - this.emailVerified = rep.isEmailVerified(); - this.attributes = rep.getAttributes(); - this.setUserProfileMetadata(rep.getUserProfileMetadata()); - - this.self = rep.getSelf(); - this.origin = rep.getOrigin(); - this.createdTimestamp = rep.getCreatedTimestamp(); - this.enabled = rep.isEnabled(); - this.totp = rep.isTotp(); - this.federationLink = rep.getFederationLink(); - this.serviceAccountClientId = rep.getServiceAccountClientId(); - this.credentials = rep.getCredentials(); - this.disableableCredentialTypes = rep.getDisableableCredentialTypes(); - this.requiredActions = rep.getRequiredActions(); - this.federatedIdentities = rep.getFederatedIdentities(); - this.realmRoles = rep.getRealmRoles(); - this.clientRoles = rep.getClientRoles(); - this.clientConsents = rep.getClientConsents(); - this.notBefore = rep.getNotBefore(); - - this.applicationRoles = rep.getApplicationRoles(); - this.socialLinks = rep.getSocialLinks(); - - this.groups = rep.getGroups(); - this.access = rep.getAccess(); - } - - public String getSelf() { - return self; - } - - public void setSelf(String self) { - this.self = self; - } - - public Long getCreatedTimestamp() { - return createdTimestamp; - } - - public void setCreatedTimestamp(Long createdTimestamp) { - this.createdTimestamp = createdTimestamp; - } - - public Boolean isEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - @Deprecated - public Boolean isTotp() { - return totp; - } - - @Deprecated - public void setTotp(Boolean totp) { - this.totp = totp; - } - - public List getCredentials() { - return credentials; - } - - public void setCredentials(List credentials) { - this.credentials = credentials; - } - - public List getRequiredActions() { - return requiredActions; - } - - public void setRequiredActions(List requiredActions) { - this.requiredActions = requiredActions; - } - - public List getFederatedIdentities() { - return federatedIdentities; - } - - public void setFederatedIdentities(List federatedIdentities) { - this.federatedIdentities = federatedIdentities; - } - - public List getSocialLinks() { - return socialLinks; - } - - public void setSocialLinks(List socialLinks) { - this.socialLinks = socialLinks; - } - - public List getRealmRoles() { - return realmRoles; - } - - public void setRealmRoles(List realmRoles) { - this.realmRoles = realmRoles; - } - - public Map> getClientRoles() { - return clientRoles; - } - - public void setClientRoles(Map> clientRoles) { - this.clientRoles = clientRoles; - } - - public List getClientConsents() { - return clientConsents; - } - - public void setClientConsents(List clientConsents) { - this.clientConsents = clientConsents; - } - - public Integer getNotBefore() { - return notBefore; - } - - public void setNotBefore(Integer notBefore) { - this.notBefore = notBefore; - } - - @Deprecated - public Map> getApplicationRoles() { - return applicationRoles; - } - - public String getFederationLink() { - return federationLink; - } - - public void setFederationLink(String federationLink) { - this.federationLink = federationLink; - } - - public String getServiceAccountClientId() { - return serviceAccountClientId; - } - - public void setServiceAccountClientId(String serviceAccountClientId) { - this.serviceAccountClientId = serviceAccountClientId; - } - - public List getGroups() { - return groups; - } - - public void setGroups(List groups) { - this.groups = groups; - } - - /** - * Returns id of UserStorageProvider that loaded this user - * - * @return NULL if user stored locally - */ - public String getOrigin() { - return origin; - } - - public void setOrigin(String origin) { - this.origin = origin; - } - - public Set getDisableableCredentialTypes() { - return disableableCredentialTypes; - } - - public void setDisableableCredentialTypes(Set disableableCredentialTypes) { - this.disableableCredentialTypes = disableableCredentialTypes; - } - - public Map getAccess() { - return access; - } - - public void setAccess(Map access) { - this.access = access; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/UserSessionRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/UserSessionRepresentation.java deleted file mode 100755 index 8bada55..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/UserSessionRepresentation.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class UserSessionRepresentation { - private String id; - private String username; - private String userId; - private String ipAddress; - private long start; - private long lastAccess; - private boolean rememberMe; - private Map clients = new HashMap<>(); - private boolean transientUser; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getIpAddress() { - return ipAddress; - } - - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } - - public long getStart() { - return start; - } - - public void setStart(long start) { - this.start = start; - } - - public long getLastAccess() { - return lastAccess; - } - - public void setLastAccess(long lastAccess) { - this.lastAccess = lastAccess; - } - - public boolean isRememberMe() { - return rememberMe; - } - - public void setRememberMe(boolean rememberMe) { - this.rememberMe = rememberMe; - } - - public Map getClients() { - return clients; - } - - public void setClients(Map clients) { - this.clients = clients; - } - - public boolean isTransientUser() { - return transientUser; - } - - public void setTransientUser(boolean transientUser) { - this.transientUser = transientUser; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/AbstractPolicyRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/AbstractPolicyRepresentation.java deleted file mode 100644 index ed9bc9c..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/AbstractPolicyRepresentation.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Objects; -import java.util.Set; - -import com.fasterxml.jackson.annotation.JsonInclude; - -/** - * @author Pedro Igor - */ -public class AbstractPolicyRepresentation { - - private String id; - private String name; - private String description; - private String type; - private Set policies; - private Set resources; - private Set scopes; - private Logic logic = Logic.POSITIVE; - private DecisionStrategy decisionStrategy = DecisionStrategy.UNANIMOUS; - private String owner; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Set resourcesData; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Set scopesData; - - public String getId() { - return this.id; - } - - public void setId(String id) { - this.id = id; - } - - public String getType() { - return this.type; - } - - public void setType(String type) { - this.type = type; - } - - public DecisionStrategy getDecisionStrategy() { - return this.decisionStrategy; - } - - public void setDecisionStrategy(DecisionStrategy decisionStrategy) { - this.decisionStrategy = decisionStrategy; - } - - public Logic getLogic() { - return logic; - } - - public void setLogic(Logic logic) { - this.logic = logic; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Set getPolicies() { - return policies; - } - - public void setPolicies(Set policies) { - this.policies = policies; - } - - public void addPolicy(String... id) { - if (this.policies == null) { - this.policies = new HashSet<>(); - } - this.policies.addAll(Arrays.asList(id)); - } - - public void removePolicy(String policy) { - if (policies != null) { - policies.remove(policy); - } - } - - public Set getResources() { - return resources; - } - - public void setResources(Set resources) { - this.resources = resources; - } - - public void addResource(String id) { - if (this.resources == null) { - this.resources = new HashSet<>(); - } - this.resources.add(id); - } - - public Set getScopes() { - return scopes; - } - - public void setScopes(Set scopes) { - this.scopes = scopes; - } - - public void addScope(String... id) { - if (this.scopes == null) { - this.scopes = new HashSet<>(); - } - this.scopes.addAll(Arrays.asList(id)); - } - - public void removeScope(String scope) { - if (scopes != null) { - scopes.remove(scope); - } - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - @Override - public boolean equals(final Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - final AbstractPolicyRepresentation policy = (AbstractPolicyRepresentation) o; - return Objects.equals(getId(), policy.getId()); - } - - @Override - public int hashCode() { - return Objects.hash(getId()); - } - - public void setResourcesData(Set resources) { - this.resourcesData = resources; - } - - public Set getResourcesData() { - return resourcesData; - } - - public void setScopesData(Set scopesData) { - this.scopesData = scopesData; - } - - public Set getScopesData() { - return scopesData; - } -} \ No newline at end of file diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/AggregatePolicyRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/AggregatePolicyRepresentation.java deleted file mode 100644 index 6ac1238..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/AggregatePolicyRepresentation.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -/** - * @author Pedro Igor - */ -public class AggregatePolicyRepresentation extends AbstractPolicyRepresentation { - - @Override - public String getType() { - return "aggregate"; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/AuthorizationRequest.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/AuthorizationRequest.java deleted file mode 100644 index 9d62835..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/AuthorizationRequest.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright 2018 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm.authorization; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - -import org.keycloak.representations.AccessToken; - -/** - * @author Pedro Igor - */ -public class AuthorizationRequest { - - private String ticket; - private String claimToken; - private String claimTokenFormat; - private String pct; - private String scope; - private PermissionTicketToken permissions = new PermissionTicketToken(); - private Metadata metadata; - private String audience; - private String subjectToken; - private boolean submitRequest; - private Map> claims; - private AccessToken rpt; - private String rptToken; - - public AuthorizationRequest(String ticket) { - this.ticket = ticket; - } - - public AuthorizationRequest() { - this(null); - } - - public String getTicket() { - return this.ticket; - } - - public void setTicket(String ticket) { - this.ticket = ticket; - } - - public AccessToken getRpt() { - return this.rpt; - } - - public void setRpt(AccessToken rpt) { - this.rpt = rpt; - } - - public void setRpt(String rpt) { - this.rptToken = rpt; - } - - public String getRptToken() { - return rptToken; - } - - public void setClaimToken(String claimToken) { - this.claimToken = claimToken; - } - - public String getClaimToken() { - return claimToken; - } - - public void setClaimTokenFormat(String claimTokenFormat) { - this.claimTokenFormat = claimTokenFormat; - } - - public String getClaimTokenFormat() { - return claimTokenFormat; - } - - public void setPct(String pct) { - this.pct = pct; - } - - public String getPct() { - return pct; - } - - public void setScope(String scope) { - this.scope = scope; - } - - public String getScope() { - return scope; - } - - public void setPermissions(PermissionTicketToken permissions) { - this.permissions = permissions; - } - - public PermissionTicketToken getPermissions() { - return permissions; - } - - public Metadata getMetadata() { - return metadata; - } - - public void setMetadata(Metadata metadata) { - this.metadata = metadata; - } - - public void setAudience(String audience) { - this.audience = audience; - } - - public String getAudience() { - return audience; - } - - public void setSubjectToken(String subjectToken) { - this.subjectToken = subjectToken; - } - - public String getSubjectToken() { - return subjectToken; - } - - public Map> getClaims() { - return claims; - } - - public void setClaims(Map> claims) { - this.claims = claims; - } - - public void addPermission(String resourceId, List scopes) { - addPermission(resourceId, scopes.toArray(new String[scopes.size()])); - } - - public void addPermission(String resourceId, String... scopes) { - if (permissions == null) { - permissions = new PermissionTicketToken(new ArrayList()); - } - - Permission permission = null; - - for (Permission resourcePermission : permissions.getPermissions()) { - if (resourcePermission.getResourceId() != null && resourcePermission.getResourceId().equals(resourceId)) { - permission = resourcePermission; - break; - } - } - - if (permission == null) { - permission = new Permission(resourceId, new HashSet()); - permissions.getPermissions().add(permission); - } - - permission.getScopes().addAll(Arrays.asList(scopes)); - } - - public void setSubmitRequest(boolean submitRequest) { - this.submitRequest = submitRequest; - } - - public boolean isSubmitRequest() { - return submitRequest && ticket != null; - } - - public static class Metadata { - - private Boolean includeResourceName; - private Integer limit; - private String responseMode; - private String permissionResourceFormat; - private Boolean permissionResourceMatchingUri; - - public Boolean getIncludeResourceName() { - if (includeResourceName == null) { - includeResourceName = Boolean.TRUE; - } - return includeResourceName; - } - - public void setIncludeResourceName(Boolean includeResourceName) { - this.includeResourceName = includeResourceName; - } - - public Integer getLimit() { - return limit; - } - - public void setLimit(Integer limit) { - this.limit = limit; - } - - public void setResponseMode(String responseMode) { - this.responseMode = responseMode; - } - - public String getResponseMode() { - return responseMode; - } - - public String getPermissionResourceFormat() { - return permissionResourceFormat; - } - - public void setPermissionResourceFormat(String permissionResourceFormat) { - this.permissionResourceFormat = permissionResourceFormat; - } - - public Boolean getPermissionResourceMatchingUri() { - return permissionResourceMatchingUri; - } - - public void setPermissionResourceMatchingUri(Boolean permissionResourceMatchingUri) { - this.permissionResourceMatchingUri = permissionResourceMatchingUri; - } - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/AuthorizationResponse.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/AuthorizationResponse.java deleted file mode 100644 index 449e1b7..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/AuthorizationResponse.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2018 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm.authorization; - -import org.keycloak.representations.AccessTokenResponse; - -/** - * @author Pedro Igor - */ -public class AuthorizationResponse extends AccessTokenResponse { - - private boolean upgraded; - - public AuthorizationResponse() { - } - - public AuthorizationResponse(AccessTokenResponse response, boolean upgraded) { - setToken(response.getToken()); - setTokenType("Bearer"); - setRefreshToken(response.getRefreshToken()); - setRefreshExpiresIn(response.getRefreshExpiresIn()); - setExpiresIn(response.getExpiresIn()); - setNotBeforePolicy(response.getNotBeforePolicy()); - this.upgraded = upgraded; - } - - public boolean isUpgraded() { - return upgraded; - } - - public void setUpgraded(boolean upgraded) { - this.upgraded = upgraded; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ClientPolicyRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ClientPolicyRepresentation.java deleted file mode 100644 index d922a8f..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ClientPolicyRepresentation.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** - * @author Pedro Igor - */ -public class ClientPolicyRepresentation extends AbstractPolicyRepresentation { - - private Set clients; - - @Override - public String getType() { - return "client"; - } - - public Set getClients() { - return clients; - } - - public void setClients(Set clients) { - this.clients = clients; - } - - public void addClient(String... id) { - if (this.clients == null) { - this.clients = new HashSet<>(); - } - this.clients.addAll(Arrays.asList(id)); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ClientScopePolicyRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ClientScopePolicyRepresentation.java deleted file mode 100644 index 624c415..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ClientScopePolicyRepresentation.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.util.HashSet; -import java.util.Set; - -/** - * @author Yoshiyuki Tabata - */ -public class ClientScopePolicyRepresentation extends AbstractPolicyRepresentation { - - private Set clientScopes; - - @Override - public String getType() { - return "client-scope"; - } - - public Set getClientScopes() { - return clientScopes; - } - - public void setClientScopes(Set clientScopes) { - this.clientScopes = clientScopes; - } - - public void addClientScope(String name, boolean required) { - if (clientScopes == null) { - clientScopes = new HashSet<>(); - } - clientScopes.add(new ClientScopeDefinition(name, required)); - } - - public void addClientScope(String name) { - addClientScope(name, false); - } - - public static class ClientScopeDefinition { - private String id; - private boolean required; - - public ClientScopeDefinition() { - this(null, false); - } - - public ClientScopeDefinition(String id, boolean required) { - this.id = id; - this.required = required; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public boolean isRequired() { - return required; - } - - public void setRequired(boolean required) { - this.required = required; - } - - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/DecisionEffect.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/DecisionEffect.java deleted file mode 100644 index cc13a08..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/DecisionEffect.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public enum DecisionEffect { - PERMIT, - DENY -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/DecisionStrategy.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/DecisionStrategy.java deleted file mode 100644 index ace8ef5..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/DecisionStrategy.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.util.Map; -import java.util.Objects; -import org.keycloak.util.EnumWithStableIndex; - -/** - * The decision strategy dictates how the policies associated with a given policy are evaluated and how a final decision - * is obtained. - * - * @author Pedro Igor - */ -public enum DecisionStrategy implements EnumWithStableIndex { - - /** - * Defines that at least one policy must evaluate to a positive decision in order to the overall decision be also positive. - */ - AFFIRMATIVE(0), - - /** - * Defines that all policies must evaluate to a positive decision in order to the overall decision be also positive. - */ - UNANIMOUS(1), - - /** - * Defines that the number of positive decisions must be greater than the number of negative decisions. If the number of positive and negative is the same, - * the final decision will be negative. - */ - CONSENSUS(2); - - private final int stableIndex; - private static final Map BY_ID = EnumWithStableIndex.getReverseIndex(values()); - - private DecisionStrategy(int stableIndex) { - Objects.requireNonNull(stableIndex); - this.stableIndex = stableIndex; - } - - @Override - public int getStableIndex() { - return stableIndex; - } - - public static DecisionStrategy valueOfInteger(Integer id) { - return id == null ? null : BY_ID.get(id); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/GroupPolicyRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/GroupPolicyRepresentation.java deleted file mode 100644 index 80a9f38..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/GroupPolicyRepresentation.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright 2017 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -/** - * @author Pedro Igor - */ -public class GroupPolicyRepresentation extends AbstractPolicyRepresentation { - - private String groupsClaim; - private Set groups; - - @Override - public String getType() { - return "group"; - } - - public String getGroupsClaim() { - return groupsClaim; - } - - public void setGroupsClaim(String groupsClaim) { - this.groupsClaim = groupsClaim; - } - - public Set getGroups() { - return groups; - } - - public void setGroups(Set groups) { - this.groups = groups; - } - - public void addGroup(String... ids) { - for (String id : ids) { - addGroup(id, false); - } - } - - public void addGroup(String id, boolean extendChildren) { - if (groups == null) { - groups = new HashSet<>(); - } - groups.add(new GroupDefinition(id, extendChildren)); - } - - public void addGroupPath(String... paths) { - for (String path : paths) { - addGroupPath(path, false); - } - } - - public void addGroupPath(String path, boolean extendChildren) { - if (groups == null) { - groups = new HashSet<>(); - } - groups.add(new GroupDefinition(null, path, extendChildren)); - } - - public void removeGroup(String... ids) { - if (groups != null) { - for (String id : ids) { - Iterator iterator = groups.iterator(); - while (iterator.hasNext()) { - GroupDefinition group = iterator.next(); - if (id.equals(group.getId()) || (group.getPath() != null && group.getPath().equals(id))) { - iterator.remove(); - } - } - } - } - } - - public static class GroupDefinition implements Comparable { - - private String id; - private String path; - private boolean extendChildren; - - public GroupDefinition() { - this(null); - } - - public GroupDefinition(String id) { - this(id, false); - } - - public GroupDefinition(String id, boolean extendChildren) { - this(id, null, extendChildren); - } - - public GroupDefinition(String id, String path, boolean extendChildren) { - this.id = id; - this.path = path; - this.extendChildren = extendChildren; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public boolean isExtendChildren() { - return extendChildren; - } - - public void setExtendChildren(boolean extendChildren) { - this.extendChildren = extendChildren; - } - - @Override - public int compareTo(GroupDefinition o) { - if (o.id == null || id == null) { - return 1; - } - return id.compareTo(o.id); - } - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/JSPolicyRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/JSPolicyRepresentation.java deleted file mode 100644 index 920f62c..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/JSPolicyRepresentation.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -/** - * @author Pedro Igor - */ -public class JSPolicyRepresentation extends AbstractPolicyRepresentation { - - private String code; - - @Override - public String getType() { - if (super.getType() == null) { - return "js"; - } - return super.getType(); - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/Logic.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/Logic.java deleted file mode 100644 index e66b147..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/Logic.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.util.Map; -import java.util.Objects; -import org.keycloak.util.EnumWithStableIndex; - -/** - * The decision strategy dictates how the policies associated with a given policy are evaluated and how a final decision - * is obtained. - * - * @author Pedro Igor - */ -public enum Logic implements EnumWithStableIndex { - - /** - * Defines that this policy follows a positive logic. In other words, the final decision is the policy outcome. - */ - POSITIVE(0), - - /** - * Defines that this policy uses a logical negation. In other words, the final decision would be a negative of the policy outcome. - */ - NEGATIVE(1); - - private final int stableIndex; - private static final Map BY_ID = EnumWithStableIndex.getReverseIndex(values()); - - private Logic(int stableIndex) { - Objects.requireNonNull(stableIndex); - this.stableIndex = stableIndex; - } - - @Override - public int getStableIndex() { - return stableIndex; - } - - public static Logic valueOfInteger(Integer id) { - return id == null ? null : BY_ID.get(id); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/Permission.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/Permission.java deleted file mode 100644 index 8316327..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/Permission.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.util.HashSet; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * @author Pedro Igor - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class Permission { - - @JsonProperty("rsid") - private String resourceId; - - @JsonProperty("rsname") - private String resourceName; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Set scopes; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - private Map> claims; - - public Permission() { - this(null, null, null, null); - } - - public Permission(final String resourceId, final Set scopes) { - this(resourceId, null, scopes, null); - } - - public Permission(final String resourceId, String resourceName, final Set scopes, Map> claims) { - this.resourceId = resourceId; - this.resourceName = resourceName; - this.scopes = scopes; - this.claims = claims; - } - - public void setResourceId(String resourceId) { - this.resourceId = resourceId; - } - - public String getResourceId() { - if (resourceId == null || "".equals(resourceId.trim())) { - return null; - } - return this.resourceId; - } - - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - public String getResourceName() { - return this.resourceName; - } - - public Set getScopes() { - if (this.scopes == null) { - this.scopes = new HashSet<>(); - } - - return this.scopes; - } - - public Map> getClaims() { - return claims; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || !getClass().isAssignableFrom(o.getClass())) return false; - - Permission that = (Permission) o; - - if (getResourceId() != null || getResourceName() != null) { - if (!getResourceId().equals(that.resourceId)) { - return false; - } - - if (getScopes().isEmpty() && that.getScopes().isEmpty()) { - return true; - } - } else if (that.resourceId != null) { - return false; - } - - for (String scope : that.getScopes()) { - if (getScopes().contains(scope)) { - return true; - } - } - - return false; - } - - @Override - public int hashCode() { - return Objects.hash(resourceId); - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - - builder.append("Permission {").append("id=").append(resourceId).append(", name=").append(resourceName) - .append(", scopes=").append(scopes).append("}"); - - return builder.toString(); - } - - public void setScopes(Set scopes) { - this.scopes = scopes; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionRequest.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionRequest.java deleted file mode 100644 index e7b9b1b..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionRequest.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2018 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm.authorization; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import org.keycloak.json.StringListMapDeserializer; - -/** - * @author Pedro Igor - */ -public class PermissionRequest { - - private String resourceId; - private Set scopes; - private String resourceServerId; - - @JsonDeserialize(using = StringListMapDeserializer.class) - private Map> claims; - - public PermissionRequest(String resourceId, String... scopes) { - this.resourceId = resourceId; - if (scopes != null) { - this.scopes = new HashSet<>(Arrays.asList(scopes)); - } - } - - public PermissionRequest() { - this(null, null); - } - - public String getResourceId() { - return resourceId; - } - - @JsonProperty("resource_id") - public void setResourceId(String resourceSetId) { - this.resourceId = resourceSetId; - } - - public Set getScopes() { - return scopes; - } - - @JsonProperty("resource_scopes") - public void setScopes(Set scopes) { - this.scopes = scopes; - } - - @JsonProperty("resource_server_id") - public void setResourceServerId(String resourceServerId) { - this.resourceServerId = resourceServerId; - } - - public String getResourceServerId() { - return resourceServerId; - } - - public Map> getClaims() { - return claims; - } - - public void setClaims(Map> claims) { - this.claims = claims; - } - - public void setClaim(String name, String... value) { - if (claims == null) { - claims = new HashMap<>(); - } - - claims.put(name, Arrays.asList(value)); - } - - public void addScope(String... name) { - if (scopes == null) { - scopes = new HashSet<>(); - } - - scopes.addAll(Arrays.asList(name)); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionResponse.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionResponse.java deleted file mode 100644 index 2d2d7bb..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionResponse.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2018 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm.authorization; - -/** - * @author Pedro Igor - */ -public class PermissionResponse { - - private final String ticket; - - public PermissionResponse(String ticket) { - this.ticket = ticket; - } - - public PermissionResponse() { - this(null); - } - - public String getTicket() { - return this.ticket; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionTicketRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionTicketRepresentation.java deleted file mode 100644 index af03373..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionTicketRepresentation.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2017 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -/** - * @author Pedro Igor - */ -public class PermissionTicketRepresentation { - - private String id; - private String owner; - private String resource; - private String scope; - private boolean granted; - private String scopeName; - private String resourceName; - private String requester; - private String ownerName; - private String requesterName; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getResource() { - return resource; - } - - public void setResource(String resource) { - this.resource = resource; - } - - public String getScope() { - return scope; - } - - public void setScope(String scope) { - this.scope = scope; - } - - public boolean isGranted() { - return granted; - } - - public void setGranted(boolean granted) { - this.granted = granted; - } - - public void setScopeName(String scopeName) { - this.scopeName = scopeName; - } - - public String getScopeName() { - return scopeName; - } - - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - public String getResourceName() { - return resourceName; - } - - public void setRequesterName(String requesterName) { - this.requesterName = requesterName; - } - - public String getRequesterName() { - return requesterName; - } - - public void setRequester(String requester) { - this.requester = requester; - } - - public String getRequester() { - return requester; - } - - public void setOwnerName(String ownerName) { - this.ownerName = ownerName; - } - - public String getOwnerName() { - return ownerName; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionTicketToken.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionTicketToken.java deleted file mode 100644 index 9f2fa5a..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionTicketToken.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2017 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import org.keycloak.TokenIdGenerator; -import org.keycloak.json.StringListMapDeserializer; -import org.keycloak.representations.AccessToken; -import org.keycloak.representations.JsonWebToken; - -/** - * @author Pedro Igor - */ -public class PermissionTicketToken extends JsonWebToken { - - private final List permissions; - - @JsonDeserialize(using = StringListMapDeserializer.class) - private Map> claims; - - public PermissionTicketToken() { - this(new ArrayList()); - } - - public PermissionTicketToken(List permissions, String audience, AccessToken accessToken) { - if (accessToken != null) { - id(TokenIdGenerator.generateId()); - subject(accessToken.getSubject()); - this.exp(accessToken.getExp()); - this.nbf(accessToken.getNbf()); - iat(accessToken.getIat()); - issuedFor(accessToken.getIssuedFor()); - } - if (audience != null) { - audience(audience); - } - this.permissions = permissions; - } - - public PermissionTicketToken(List resources) { - this(resources, null, null); - } - - public List getPermissions() { - return this.permissions; - } - - public Map> getClaims() { - return claims; - } - - public void setClaims(Map> claims) { - this.claims = claims; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEnforcementMode.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEnforcementMode.java deleted file mode 100644 index ee303b4..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEnforcementMode.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.util.Map; -import java.util.Objects; -import org.keycloak.util.EnumWithStableIndex; - -/** - * The policy enforcement mode dictates how authorization requests are handled by the server. - * - * @author Pedro Igor - */ -public enum PolicyEnforcementMode implements EnumWithStableIndex { - - /** - * Requests are denied by default even when there is no policy associated with a given resource. - */ - ENFORCING(0), - - /** - * Requests are allowed even when there is no policy associated with a given resource. - */ - PERMISSIVE(1), - - /** - * Completely disables the evaluation of policies and allow access to any resource. - */ - DISABLED(2); - - private final int stableIndex; - private static final Map BY_ID = EnumWithStableIndex.getReverseIndex(values()); - - private PolicyEnforcementMode(int stableIndex) { - Objects.requireNonNull(stableIndex); - this.stableIndex = stableIndex; - } - - @Override - public int getStableIndex() { - return stableIndex; - } - - public static PolicyEnforcementMode valueOfInteger(Integer id) { - return id == null ? null : BY_ID.get(id); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEvaluationRequest.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEvaluationRequest.java deleted file mode 100644 index d566394..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEvaluationRequest.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2016 Red Hat, Inc., and individual contributors - * as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm.authorization; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -/** - * @author Pedro Igor - */ -public class PolicyEvaluationRequest { - - private Map> context = new HashMap<>(); - private List resources = new LinkedList<>(); - private String clientId; - private String userId; - private List roleIds = new LinkedList<>(); - private boolean entitlements; - - public Map> getContext() { - return this.context; - } - - public void setContext(Map> context) { - this.context = context; - } - - public List getResources() { - return this.resources; - } - - public void setResources(List resources) { - this.resources = resources; - } - - public String getClientId() { - return this.clientId; - } - - public void setClientId(final String clientId) { - this.clientId = clientId; - } - - public String getUserId() { - return this.userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public List getRoleIds() { - return this.roleIds; - } - - public void setRoleIds(List roleIds) { - this.roleIds = roleIds; - } - - public boolean isEntitlements() { - return entitlements; - } - - public void setEntitlements(boolean entitlements) { - this.entitlements = entitlements; - } - - public PolicyEvaluationRequest addResource(String name, String... scopes) { - if (resources == null) { - resources = new LinkedList<>(); - } - resources.add(new ResourceRepresentation(name, scopes)); - return this; - } - - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEvaluationResponse.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEvaluationResponse.java deleted file mode 100644 index bfa4c30..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEvaluationResponse.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2016 Red Hat, Inc., and individual contributors - * as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.idm.authorization; - -import org.keycloak.representations.AccessToken; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * @author Pedro Igor - */ -public class PolicyEvaluationResponse { - - private List results; - private boolean entitlements; - private DecisionEffect status; - private AccessToken rpt; - - public List getResults() { - return results; - } - - public DecisionEffect getStatus() { - return status; - } - - public boolean isEntitlements() { - return entitlements; - } - - public AccessToken getRpt() { - return rpt; - } - - public void setResults(List results) { - this.results = results; - } - - public void setEntitlements(boolean entitlements) { - this.entitlements = entitlements; - } - - public void setStatus(DecisionEffect status) { - this.status = status; - } - - public void setRpt(AccessToken rpt) { - this.rpt = rpt; - } - - public static class EvaluationResultRepresentation { - - private ResourceRepresentation resource; - private List scopes; - private List policies; - private DecisionEffect status; - private List allowedScopes = new ArrayList<>(); - - public void setResource(final ResourceRepresentation resource) { - this.resource = resource; - } - - public ResourceRepresentation getResource() { - return resource; - } - - public void setScopes(List scopes) { - this.scopes = scopes; - } - - public List getScopes() { - return scopes; - } - - public void setPolicies(final List policies) { - this.policies = policies; - } - - public List getPolicies() { - return policies; - } - - public void setStatus(final DecisionEffect status) { - this.status = status; - } - - public DecisionEffect getStatus() { - return status; - } - - public void setAllowedScopes(List allowedScopes) { - this.allowedScopes = allowedScopes; - } - - public List getAllowedScopes() { - return allowedScopes; - } - } - - public static class PolicyResultRepresentation { - - private PolicyRepresentation policy; - private DecisionEffect status; - private List associatedPolicies; - private Set scopes = new HashSet<>(); - - public PolicyRepresentation getPolicy() { - return policy; - } - - public void setPolicy(final PolicyRepresentation policy) { - this.policy = policy; - } - - public DecisionEffect getStatus() { - return status; - } - - public void setStatus(final DecisionEffect status) { - this.status = status; - } - - public List getAssociatedPolicies() { - return associatedPolicies; - } - - public void setAssociatedPolicies(final List associatedPolicies) { - this.associatedPolicies = associatedPolicies; - } - - @Override - public int hashCode() { - return this.policy.hashCode(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - final PolicyResultRepresentation policy = (PolicyResultRepresentation) o; - return this.policy.equals(policy.getPolicy()); - } - - public void setScopes(Set scopes) { - this.scopes = scopes; - } - - public Set getScopes() { - return scopes; - } - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyProviderRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyProviderRepresentation.java deleted file mode 100644 index 88cb0dd..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyProviderRepresentation.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -/** - * @author Pedro Igor - */ -public class PolicyProviderRepresentation { - - private String type; - private String name; - private String group; - - public String getType() { - return this.type; - } - - public void setType( String type) { - this.type = type; - } - - public String getName() { - return this.name; - } - - public void setName( String name) { - this.name = name; - } - - public String getGroup() { - return this.group; - } - - public void setGroup( String group) { - this.group = group; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyRepresentation.java deleted file mode 100644 index e36d7af..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyRepresentation.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Pedro Igor - */ -public class PolicyRepresentation extends AbstractPolicyRepresentation { - - private Map config = new HashMap(); - - public Map getConfig() { - return this.config; - } - - public void setConfig(Map config) { - this.config = config; - } -} \ No newline at end of file diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/RegexPolicyRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/RegexPolicyRepresentation.java deleted file mode 100644 index 90adebe..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/RegexPolicyRepresentation.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -/** - * @author Yoshiyuki Tabata - */ -public class RegexPolicyRepresentation extends AbstractPolicyRepresentation { - - private String targetClaim; - private String pattern; - private boolean targetContextAttributes; - - @Override - public String getType() { - return "regex"; - } - - public String getTargetClaim() { - return targetClaim; - } - - public void setTargetClaim(String targetClaim) { - this.targetClaim = targetClaim; - } - - public String getPattern() { - return pattern; - } - - public void setPattern(String pattern) { - this.pattern = pattern; - } - - public boolean isTargetContextAttributes() { - return targetContextAttributes; - } - - public void setTargetContextAttributes(boolean targetContextAttributes) { - this.targetContextAttributes = targetContextAttributes; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceOwnerRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceOwnerRepresentation.java deleted file mode 100644 index 4188ab3..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceOwnerRepresentation.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -/** - * @author Pedro Igor - */ -public class ResourceOwnerRepresentation { - - private String id; - private String name; - - public ResourceOwnerRepresentation() { - - } - - public ResourceOwnerRepresentation(String id) { - this.id = id; - } - - public String getId() { - return this.id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ResourcePermissionRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ResourcePermissionRepresentation.java deleted file mode 100644 index 80f7106..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ResourcePermissionRepresentation.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -/** - * @author Pedro Igor - */ -public class ResourcePermissionRepresentation extends AbstractPolicyRepresentation { - - private String resourceType; - - @Override - public String getType() { - return "resource"; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public String getResourceType() { - return resourceType; - } -} \ No newline at end of file diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceRepresentation.java deleted file mode 100644 index dc012bb..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceRepresentation.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.net.URI; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import org.keycloak.json.StringListMapDeserializer; - -/** - *

One or more resources that the resource server manages as a set of protected resources. - * - *

For more details, OAuth-resource-reg. - * - * @author Pedro Igor - */ -public class ResourceRepresentation { - - @JsonProperty("_id") - private String id; - - private String name; - - @JsonProperty("uris") - private Set uris; - private String type; - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("scopes") - private Set scopes; - - @JsonProperty("icon_uri") - private String iconUri; - private ResourceOwnerRepresentation owner; - private Boolean ownerManagedAccess; - - private String displayName; - - @JsonDeserialize(using = StringListMapDeserializer.class) - private Map> attributes; - - /** - * Creates a new instance. - * - * @param name a human-readable string describing a set of one or more resources - * @param uris a {@link List} of {@link URI} that provides network locations for the resource set being registered - * @param type a string uniquely identifying the semantics of the resource set - * @param scopes the available scopes for this resource set - * @param iconUri a {@link URI} for a graphic icon representing the resource set - */ - public ResourceRepresentation(String name, Set scopes, Set uris, String type, String iconUri) { - this.name = name; - this.scopes = scopes; - this.uris = uris; - this.type = type; - this.iconUri = iconUri; - } - - public ResourceRepresentation(String name, Set scopes, String uri, String type, String iconUri) { - this(name, scopes, Collections.singleton(uri), type, iconUri); - } - - /** - * Creates a new instance. - * - * @param name a human-readable string describing a set of one or more resources - * @param uris a {@link List} of {@link URI} that provides the network location for the resource set being registered - * @param type a string uniquely identifying the semantics of the resource set - * @param scopes the available scopes for this resource set - */ - public ResourceRepresentation(String name, Set scopes, Set uris, String type) { - this(name, scopes, uris, type, null); - } - - public ResourceRepresentation(String name, Set scopes, String uri, String type) { - this(name, scopes, Collections.singleton(uri), type, null); - } - - /** - * Creates a new instance. - * - * @param name a human-readable string describing a set of one or more resources - * @param serverUri a {@link URI} that identifies this resource server - * @param scopes the available scopes for this resource set - */ - public ResourceRepresentation(String name, Set scopes) { - this(name, scopes, (Set) null, null, null); - } - - public ResourceRepresentation(String name, String... scopes) { - this.name = name; - this.scopes = new HashSet<>(); - for (String s : scopes) { - ScopeRepresentation rep = new ScopeRepresentation(s); - this.scopes.add(rep); - } - } - - /** - * Creates a new instance. - * - */ - public ResourceRepresentation() { - this(null, null, (Set) null, null, null); - } - - public void setId(String id) { - this.id = id; - } - - public String getId() { - return this.id; - } - - public String getName() { - return this.name; - } - - public String getDisplayName() { - return displayName; - } - - @Deprecated - @JsonIgnore - public String getUri() { - if (this.uris == null || this.uris.isEmpty()) { - return null; - } - - return this.uris.iterator().next(); - } - - public Set getUris() { - return this.uris; - } - - public String getType() { - return this.type; - } - - public Set getScopes() { - if (this.scopes == null) { - return Collections.emptySet(); - } - - return Collections.unmodifiableSet(this.scopes); - } - - public String getIconUri() { - return this.iconUri; - } - - public void setName(String name) { - this.name = name; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - @Deprecated - @JsonSetter("uri") - public void setUri(String uri) { - if (uri != null && !"".equalsIgnoreCase(uri.trim())) { - this.uris = Collections.singleton(uri); - } - } - - public void setUris(Set uris) { - if (uris != null) { - Set resultSet = new HashSet<>(); - for (String uri : uris) { - if (uri != null && !"".equalsIgnoreCase(uri.trim())) { - resultSet.add(uri); - } - } - - this.uris = resultSet; - } - } - - public void setType(String type) { - if (type != null && !"".equalsIgnoreCase(type.trim())) { - this.type = type; - } - } - - public void setScopes(Set scopes) { - this.scopes = scopes; - } - - /** - * TODO: This is a workaround to allow deserialization of UMA resource representation. Jackson 2.19+ support aliases, once we upgrade, change this. - * - * @param scopes - */ - @JsonSetter("resource_scopes") - private void setScopesUma(Set scopes) { - this.scopes = scopes; - } - - public void setIconUri(String iconUri) { - this.iconUri = iconUri; - } - - public ResourceOwnerRepresentation getOwner() { - return this.owner; - } - - @JsonProperty - public void setOwner(ResourceOwnerRepresentation owner) { - this.owner = owner; - } - - @JsonIgnore - public void setOwner(String ownerId) { - if (ownerId == null) { - owner = null; - return; - } - - if (owner == null) { - owner = new ResourceOwnerRepresentation(); - } - - owner.setId(ownerId); - } - - public Boolean getOwnerManagedAccess() { - return ownerManagedAccess; - } - - public void setOwnerManagedAccess(Boolean ownerManagedAccess) { - this.ownerManagedAccess = ownerManagedAccess; - } - - public void addScope(String... scopeNames) { - if (scopes == null) { - scopes = new HashSet<>(); - } - for (String scopeName : scopeNames) { - scopes.add(new ScopeRepresentation(scopeName)); - } - } - - public void addScope(ScopeRepresentation scope) { - if (scopes == null) { - scopes = new HashSet<>(); - } - scopes.add(scope); - } - - public Map> getAttributes() { - return attributes; - } - - public void setAttributes(Map> attributes) { - this.attributes = attributes; - } - - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ResourceRepresentation scope = (ResourceRepresentation) o; - return Objects.equals(getName(), scope.getName()); - } - - public int hashCode() { - return Objects.hash(getName()); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceServerRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceServerRepresentation.java deleted file mode 100644 index f5ce88d..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceServerRepresentation.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.util.List; - -import static java.util.Collections.emptyList; - -/** - * @author Pedro Igor - */ -public class ResourceServerRepresentation { - - private String id; - - private String clientId; - private String name; - private boolean allowRemoteResourceManagement = true; - private PolicyEnforcementMode policyEnforcementMode = PolicyEnforcementMode.ENFORCING; - private List resources = emptyList(); - private List policies = emptyList(); - private List scopes = emptyList(); - private DecisionStrategy decisionStrategy; - - public void setId(String id) { - this.id = id; - } - - public String getId() { - return this.id; - } - - public String getClientId() { - return clientId; - } - - public void setClientId(String clientId) { - this.clientId = clientId; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - public boolean isAllowRemoteResourceManagement() { - return this.allowRemoteResourceManagement; - } - - public void setAllowRemoteResourceManagement(boolean allowRemoteResourceManagement) { - this.allowRemoteResourceManagement = allowRemoteResourceManagement; - } - - public PolicyEnforcementMode getPolicyEnforcementMode() { - return this.policyEnforcementMode; - } - - public void setPolicyEnforcementMode(PolicyEnforcementMode policyEnforcementMode) { - this.policyEnforcementMode = policyEnforcementMode; - } - - public void setResources(List resources) { - this.resources = resources; - } - - public List getResources() { - return resources; - } - - public void setPolicies(List policies) { - this.policies = policies; - } - - public List getPolicies() { - return policies; - } - - public void setScopes(List scopes) { - this.scopes = scopes; - } - - public List getScopes() { - return scopes; - } - - public void setDecisionStrategy(DecisionStrategy decisionStrategy) { - this.decisionStrategy = decisionStrategy; - } - - public DecisionStrategy getDecisionStrategy() { - return decisionStrategy; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/RolePolicyRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/RolePolicyRepresentation.java deleted file mode 100644 index 7dfda00..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/RolePolicyRepresentation.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.util.HashSet; -import java.util.Set; - -/** - * @author Pedro Igor - */ -public class RolePolicyRepresentation extends AbstractPolicyRepresentation { - - private Set roles; - private Boolean fetchRoles; - - @Override - public String getType() { - return "role"; - } - - public Set getRoles() { - return roles; - } - - public void setRoles(Set roles) { - this.roles = roles; - } - - public void addRole(String name, Boolean required) { - if (roles == null) { - roles = new HashSet<>(); - } - roles.add(new RoleDefinition(name, required)); - } - - public void addRole(String name) { - addRole(name, false); - } - - public void addClientRole(String clientId, String name) { - addRole(clientId + "/" +name, false); - } - - public void addClientRole(String clientId, String name, boolean required) { - addRole(clientId + "/" + name, required); - } - - public Boolean isFetchRoles() { - return fetchRoles; - } - - public void setFetchRoles(Boolean fetchRoles) { - this.fetchRoles = fetchRoles; - } - - public static class RoleDefinition implements Comparable { - - private String id; - private Boolean required; - - public RoleDefinition() { - this(null, false); - } - - public RoleDefinition(String id, Boolean required) { - this.id = id; - this.required = required; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Boolean isRequired() { - return required; - } - - public void setRequired(Boolean required) { - this.required = required; - } - - @Override - public int compareTo(RoleDefinition o) { - if (id == null || o.id == null) { - return 1; - } - return id.compareTo(o.id); - } - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ScopePermissionRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ScopePermissionRepresentation.java deleted file mode 100644 index 1f08553..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ScopePermissionRepresentation.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -/** - * @author Pedro Igor - */ -public class ScopePermissionRepresentation extends AbstractPolicyRepresentation { - - private String resourceType; - - @Override - public String getType() { - return "scope"; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public String getResourceType() { - return resourceType; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ScopeRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ScopeRepresentation.java deleted file mode 100644 index e6445e4..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/ScopeRepresentation.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.net.URI; -import java.util.List; -import java.util.Objects; - -/** - *

A bounded extent of access that is possible to perform on a resource set. In authorization policy terminology, - * a scope is one of the potentially many "verbs" that can logically apply to a resource set ("object"). - * - *

For more details, OAuth-resource-reg. - * - * @author Pedro Igor - */ -public class ScopeRepresentation { - - private String id; - private String name; - private String iconUri; - private List policies; - private List resources; - private String displayName; - - /** - * Creates an instance. - * - * @param name the a human-readable string describing some scope (extent) of access - * @param iconUri a {@link URI} for a graphic icon representing the scope - */ - public ScopeRepresentation(String name, String iconUri) { - this.name = name; - this.iconUri = iconUri; - } - - /** - * Creates an instance. - * - * @param name the a human-readable string describing some scope (extent) of access - */ - public ScopeRepresentation(String name) { - this(name, null); - } - - /** - * Creates an instance. - */ - public ScopeRepresentation() { - this(null, null); - } - - public String getName() { - return this.name; - } - - public String getDisplayName() { - return displayName; - } - - public String getIconUri() { - return this.iconUri; - } - - public String getId() { - return this.id; - } - - public void setId(String id) { - this.id = id; - } - - public void setName(String name) { - this.name = name; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public void setIconUri(String iconUri) { - this.iconUri = iconUri; - } - - public List getPolicies() { - return this.policies; - } - - public void setPolicies(List policies) { - this.policies = policies; - } - - public List getResources() { - return this.resources; - } - - public void setResources(List resources) { - this.resources = resources; - } - - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ScopeRepresentation scope = (ScopeRepresentation) o; - return Objects.equals(getName(), scope.getName()); - } - - public int hashCode() { - return Objects.hash(getName()); - } -} \ No newline at end of file diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/TimePolicyRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/TimePolicyRepresentation.java deleted file mode 100644 index 8b8e66a..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/TimePolicyRepresentation.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -/** - * @author Pedro Igor - */ -public class TimePolicyRepresentation extends AbstractPolicyRepresentation { - - private String notBefore; - private String notOnOrAfter; - private String dayMonth; - private String dayMonthEnd; - private String month; - private String monthEnd; - private String year; - private String yearEnd; - private String hour; - private String hourEnd; - private String minute; - private String minuteEnd; - - @Override - public String getType() { - return "time"; - } - - public String getNotBefore() { - return notBefore; - } - - public void setNotBefore(String notBefore) { - this.notBefore = notBefore; - } - - public String getNotOnOrAfter() { - return notOnOrAfter; - } - - public void setNotOnOrAfter(String notOnOrAfter) { - this.notOnOrAfter = notOnOrAfter; - } - - public String getDayMonth() { - return dayMonth; - } - - public void setDayMonth(String dayMonth) { - this.dayMonth = dayMonth; - } - - public String getDayMonthEnd() { - return dayMonthEnd; - } - - public void setDayMonthEnd(String dayMonthEnd) { - this.dayMonthEnd = dayMonthEnd; - } - - public String getMonth() { - return month; - } - - public void setMonth(String month) { - this.month = month; - } - - public String getMonthEnd() { - return monthEnd; - } - - public void setMonthEnd(String monthEnd) { - this.monthEnd = monthEnd; - } - - public String getYear() { - return year; - } - - public void setYear(String year) { - this.year = year; - } - - public String getYearEnd() { - return yearEnd; - } - - public void setYearEnd(String yearEnd) { - this.yearEnd = yearEnd; - } - - public String getHour() { - return hour; - } - - public void setHour(String hour) { - this.hour = hour; - } - - public String getHourEnd() { - return hourEnd; - } - - public void setHourEnd(String hourEnd) { - this.hourEnd = hourEnd; - } - - public String getMinute() { - return minute; - } - - public void setMinute(String minute) { - this.minute = minute; - } - - public String getMinuteEnd() { - return minuteEnd; - } - - public void setMinuteEnd(String minuteEnd) { - this.minuteEnd = minuteEnd; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/UmaPermissionRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/UmaPermissionRepresentation.java deleted file mode 100644 index ee9a78c..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/UmaPermissionRepresentation.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2016 Red Hat, Inc., and individual contributors - * as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** - * @author Federico M. Facca - */ -public class UmaPermissionRepresentation extends AbstractPolicyRepresentation { - - private Set roles; - private Set groups; - private Set clients; - private Set users; - private String condition; - - @Override - public String getType() { - return "uma"; - } - - public void setRoles(Set roles) { - this.roles = roles; - } - - public void addRole(String... role) { - if (roles == null) { - roles = new HashSet<>(); - } - - roles.addAll(Arrays.asList(role)); - } - - public void addClientRole(String clientId, String roleName) { - addRole(clientId + "/" + roleName); - } - - public void removeRole(String role) { - if (roles != null) { - roles.remove(role); - } - } - - public Set getRoles() { - return roles; - } - - public void setGroups(Set groups) { - this.groups = groups; - } - - public void addGroup(String... group) { - if (groups == null) { - groups = new HashSet<>(); - } - - groups.addAll(Arrays.asList(group)); - } - - public void removeGroup(String group) { - if (groups != null) { - groups.remove(group); - } - } - - public Set getGroups() { - return groups; - } - - public void setClients(Set clients) { - this.clients = clients; - } - - public void addClient(String... client) { - if (clients == null) { - clients = new HashSet<>(); - } - - clients.addAll(Arrays.asList(client)); - } - - public void removeClient(String client) { - if (clients != null) { - clients.remove(client); - } - } - - public Set getClients() { - return clients; - } - - public void setUsers(Set users) { - this.users = users; - } - - public void addUser(String... user) { - if (this.users == null) { - this.users = new HashSet<>(); - } - this.users.addAll(Arrays.asList(user)); - } - - public void removeUser(String user) { - if (this.users != null) { - this.users.remove(user); - } - } - - public Set getUsers() { - return this.users; - } - - public void setCondition(String condition) { - this.condition = condition; - } - - public String getCondition() { - return condition; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/UserPolicyRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/idm/authorization/UserPolicyRepresentation.java deleted file mode 100644 index 239e55f..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/idm/authorization/UserPolicyRepresentation.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.representations.idm.authorization; - -import java.util.HashSet; -import java.util.Set; - -/** - * @author Pedro Igor - */ -public class UserPolicyRepresentation extends AbstractPolicyRepresentation { - - private Set users; - - @Override - public String getType() { - return "user"; - } - - public Set getUsers() { - return users; - } - - public void setUsers(Set users) { - this.users= users; - } - - public void addUser(String name) { - if (users == null) { - users = new HashSet<>(); - } - users.add(name); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/info/ClientInstallationRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/info/ClientInstallationRepresentation.java deleted file mode 100755 index 8d6136e..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/info/ClientInstallationRepresentation.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.info; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class ClientInstallationRepresentation { - protected String id; - protected String protocol; - protected boolean downloadOnly; - protected String displayType; - protected String helpText; - protected String filename; - protected String mediaType; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public boolean isDownloadOnly() { - return downloadOnly; - } - - public void setDownloadOnly(boolean downloadOnly) { - this.downloadOnly = downloadOnly; - } - - public String getDisplayType() { - return displayType; - } - - public void setDisplayType(String displayType) { - this.displayType = displayType; - } - - public String getHelpText() { - return helpText; - } - - public void setHelpText(String helpText) { - this.helpText = helpText; - } - - public String getFilename() { - return filename; - } - - public void setFilename(String filename) { - this.filename = filename; - } - - public String getMediaType() { - return mediaType; - } - - public void setMediaType(String mediaType) { - this.mediaType = mediaType; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/info/CryptoInfoRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/info/CryptoInfoRepresentation.java deleted file mode 100644 index 0f3d1f8..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/info/CryptoInfoRepresentation.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2022 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.keycloak.representations.info; - -import java.util.List; - -/** - * @author Marek Posolda - */ -public class CryptoInfoRepresentation { - - private String cryptoProvider; - private List supportedKeystoreTypes; - - private List clientSignatureSymmetricAlgorithms; - - private List clientSignatureAsymmetricAlgorithms; - - public String getCryptoProvider() { - return cryptoProvider; - } - - public void setCryptoProvider(String cryptoProvider) { - this.cryptoProvider = cryptoProvider; - } - - public List getSupportedKeystoreTypes() { - return supportedKeystoreTypes; - } - - public void setSupportedKeystoreTypes(List supportedKeystoreTypes) { - this.supportedKeystoreTypes = supportedKeystoreTypes; - } - - public List getClientSignatureSymmetricAlgorithms() { - return clientSignatureSymmetricAlgorithms; - } - - public void setClientSignatureSymmetricAlgorithms(List clientSignatureSymmetricAlgorithms) { - this.clientSignatureSymmetricAlgorithms = clientSignatureSymmetricAlgorithms; - } - - public List getClientSignatureAsymmetricAlgorithms() { - return clientSignatureAsymmetricAlgorithms; - } - - public void setClientSignatureAsymmetricAlgorithms(List clientSignatureAsymmetricAlgorithms) { - this.clientSignatureAsymmetricAlgorithms = clientSignatureAsymmetricAlgorithms; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/info/FeatureRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/info/FeatureRepresentation.java deleted file mode 100644 index 4667844..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/info/FeatureRepresentation.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.keycloak.representations.info; - -import java.util.Set; - -public class FeatureRepresentation { - private String name; - private String label; - private FeatureType type; - private boolean isEnabled; - private Set dependencies; - - public FeatureRepresentation() { - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public FeatureType getType() { - return type; - } - - public void setType(FeatureType type) { - this.type = type; - } - - public boolean isEnabled() { - return isEnabled; - } - - public void setEnabled(boolean enabled) { - isEnabled = enabled; - } - - public Set getDependencies() { - return dependencies; - } - - public void setDependencies(Set dependencies) { - this.dependencies = dependencies; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/info/FeatureType.java b/authz-client/src/main/java/org/keycloak/representations/info/FeatureType.java deleted file mode 100644 index c9564cb..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/info/FeatureType.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2024 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.keycloak.representations.info; - -/** - * @author Marek Posolda - */ -public enum FeatureType { - DEFAULT, - DISABLED_BY_DEFAULT, - PREVIEW, - PREVIEW_DISABLED_BY_DEFAULT, - EXPERIMENTAL, - DEPRECATED; -} diff --git a/authz-client/src/main/java/org/keycloak/representations/info/MemoryInfoRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/info/MemoryInfoRepresentation.java deleted file mode 100644 index 22a104d..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/info/MemoryInfoRepresentation.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.info; - -public class MemoryInfoRepresentation { - - protected long total; - protected String totalFormated; - protected long used; - protected String usedFormated; - protected long free; - protected long freePercentage; - protected String freeFormated; - - public static MemoryInfoRepresentation create() { - MemoryInfoRepresentation rep = new MemoryInfoRepresentation(); - Runtime runtime = Runtime.getRuntime(); - rep.total = runtime.maxMemory(); - rep.totalFormated = formatMemory(rep.total); - rep.used = runtime.totalMemory() - runtime.freeMemory(); - rep.usedFormated = formatMemory(rep.used); - rep.free = rep.total - rep.used; - rep.freeFormated = formatMemory(rep.free); - rep.freePercentage = rep.free * 100 / rep.total; - return rep; - } - - public long getTotal() { - return total; - } - - public String getTotalFormated() { - return totalFormated; - } - - public long getFree() { - return free; - } - - public String getFreeFormated() { - return freeFormated; - } - - public long getUsed() { - return used; - } - - public String getUsedFormated() { - return usedFormated; - } - - public long getFreePercentage() { - return freePercentage; - } - - private static String formatMemory(long bytes) { - if (bytes > 1024L * 1024L) { - return bytes / (1024L * 1024L) + " MB"; - } else if (bytes > 1024L) { - return bytes / (1024L) + " kB"; - } else { - return bytes + " B"; - } - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/info/ProfileInfoRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/info/ProfileInfoRepresentation.java deleted file mode 100644 index a25440a..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/info/ProfileInfoRepresentation.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.info; - - -import java.util.List; - -/** - * @author Stian Thorgersen - */ -public class ProfileInfoRepresentation { - - private String name; - private List disabledFeatures; - private List previewFeatures; - private List experimentalFeatures; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List getDisabledFeatures() { - return disabledFeatures; - } - - public void setDisabledFeatures(List disabledFeatures) { - this.disabledFeatures = disabledFeatures; - } - - public List getPreviewFeatures() { - return previewFeatures; - } - - public void setPreviewFeatures(List previewFeatures) { - this.previewFeatures = previewFeatures; - } - - public List getExperimentalFeatures() { - return experimentalFeatures; - } - - public void setExperimentalFeatures(List experimentalFeatures) { - this.experimentalFeatures = experimentalFeatures; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/info/ProviderRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/info/ProviderRepresentation.java deleted file mode 100644 index 8dcf006..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/info/ProviderRepresentation.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.info; - -import java.util.Map; - -public class ProviderRepresentation { - - private int order; - - private Map operationalInfo; - - public int getOrder() { - return order; - } - - public void setOrder(int priorityUI) { - this.order = priorityUI; - } - - public Map getOperationalInfo() { - return operationalInfo; - } - - public void setOperationalInfo(Map operationalInfo) { - this.operationalInfo = operationalInfo; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/info/ServerInfoRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/info/ServerInfoRepresentation.java deleted file mode 100755 index adb1520..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/info/ServerInfoRepresentation.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.info; - -import org.keycloak.representations.idm.ComponentTypeRepresentation; -import org.keycloak.representations.idm.PasswordPolicyTypeRepresentation; -import org.keycloak.representations.idm.ProtocolMapperRepresentation; -import org.keycloak.representations.idm.ProtocolMapperTypeRepresentation; - -import java.util.List; -import java.util.Map; - -/** - * @author Stian Thorgersen - */ -public class ServerInfoRepresentation { - - private SystemInfoRepresentation systemInfo; - private MemoryInfoRepresentation memoryInfo; - private ProfileInfoRepresentation profileInfo; - - private List features; - - private CryptoInfoRepresentation cryptoInfo; - - private Map> themes; - - private List> socialProviders; - private List> identityProviders; - private List> clientImporters; - - private Map providers; - - private Map> protocolMapperTypes; - private Map> builtinProtocolMappers; - private Map> clientInstallations; - private Map> componentTypes; - - private List passwordPolicies; - - private Map> enums; - - public SystemInfoRepresentation getSystemInfo() { - return systemInfo; - } - - public void setSystemInfo(SystemInfoRepresentation systemInfo) { - this.systemInfo = systemInfo; - } - - public MemoryInfoRepresentation getMemoryInfo() { - return memoryInfo; - } - - public void setMemoryInfo(MemoryInfoRepresentation memoryInfo) { - this.memoryInfo = memoryInfo; - } - - public ProfileInfoRepresentation getProfileInfo() { - return profileInfo; - } - - public void setProfileInfo(ProfileInfoRepresentation profileInfo) { - this.profileInfo = profileInfo; - } - - public List getFeatures() { - return features; - } - - public void setFeatures(List features) { - this.features = features; - } - - public CryptoInfoRepresentation getCryptoInfo() { - return cryptoInfo; - } - - public void setCryptoInfo(CryptoInfoRepresentation cryptoInfo) { - this.cryptoInfo = cryptoInfo; - } - - public Map> getThemes() { - return themes; - } - - public void setThemes(Map> themes) { - this.themes = themes; - } - - public List> getSocialProviders() { - return socialProviders; - } - - public void setSocialProviders(List> socialProviders) { - this.socialProviders = socialProviders; - } - - public List> getIdentityProviders() { - return identityProviders; - } - - public void setIdentityProviders(List> identityProviders) { - this.identityProviders = identityProviders; - } - - public List> getClientImporters() { - return clientImporters; - } - - public void setClientImporters(List> clientImporters) { - this.clientImporters = clientImporters; - } - - public Map getProviders() { - return providers; - } - - public void setProviders(Map providers) { - this.providers = providers; - } - - public Map> getProtocolMapperTypes() { - return protocolMapperTypes; - } - - public void setProtocolMapperTypes(Map> protocolMapperTypes) { - this.protocolMapperTypes = protocolMapperTypes; - } - - public Map> getBuiltinProtocolMappers() { - return builtinProtocolMappers; - } - - public void setBuiltinProtocolMappers(Map> builtinProtocolMappers) { - this.builtinProtocolMappers = builtinProtocolMappers; - } - - public Map> getEnums() { - return enums; - } - - public void setEnums(Map> enums) { - this.enums = enums; - } - - public Map> getClientInstallations() { - return clientInstallations; - } - - public void setClientInstallations(Map> clientInstallations) { - this.clientInstallations = clientInstallations; - } - - public List getPasswordPolicies() { - return passwordPolicies; - } - - public void setPasswordPolicies(List passwordPolicies) { - this.passwordPolicies = passwordPolicies; - } - - public Map> getComponentTypes() { - return componentTypes; - } - - public void setComponentTypes(Map> componentTypes) { - this.componentTypes = componentTypes; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/info/SpiInfoRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/info/SpiInfoRepresentation.java deleted file mode 100644 index ea93362..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/info/SpiInfoRepresentation.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.info; - -import java.util.Map; - -/** - * @author Stian Thorgersen - */ -public class SpiInfoRepresentation { - - private boolean internal; - - private Map providers; - - public boolean isInternal() { - return internal; - } - - public void setInternal(boolean internal) { - this.internal = internal; - } - - public Map getProviders() { - return providers; - } - - public void setProviders(Map providers) { - this.providers = providers; - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/info/SystemInfoRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/info/SystemInfoRepresentation.java deleted file mode 100755 index 0948343..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/info/SystemInfoRepresentation.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.representations.info; - - -import java.util.Date; -import java.util.Locale; - -public class SystemInfoRepresentation { - - private String version; - private String serverTime; - private String uptime; - private long uptimeMillis; - private String javaVersion; - private String javaVendor; - private String javaVm; - private String javaVmVersion; - private String javaRuntime; - private String javaHome; - private String osName; - private String osArchitecture; - private String osVersion; - private String fileEncoding; - private String userName; - private String userDir; - private String userTimezone; - private String userLocale; - - public static SystemInfoRepresentation create(long serverStartupTime, String serverVersion) { - SystemInfoRepresentation rep = new SystemInfoRepresentation(); - rep.version = serverVersion; - rep.serverTime = new Date().toString(); - rep.uptimeMillis = System.currentTimeMillis() - serverStartupTime; - rep.uptime = formatUptime(rep.uptimeMillis); - rep.javaVersion = System.getProperty("java.version"); - rep.javaVendor = System.getProperty("java.vendor"); - rep.javaVm = System.getProperty("java.vm.name"); - rep.javaVmVersion = System.getProperty("java.vm.version"); - rep.javaRuntime = System.getProperty("java.runtime.name"); - rep.javaHome = System.getProperty("java.home"); - rep.osName = System.getProperty("os.name"); - rep.osArchitecture = System.getProperty("os.arch"); - rep.osVersion = System.getProperty("os.version"); - rep.fileEncoding = System.getProperty("file.encoding"); - rep.userName = System.getProperty("user.name"); - rep.userDir = System.getProperty("user.dir"); - rep.userTimezone = System.getProperty("user.timezone"); - if (System.getProperty("user.country") != null && System.getProperty("user.language") != null) { - rep.userLocale = (new Locale(System.getProperty("user.language"), System.getProperty("user.country")).toString()); - } - return rep; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getServerTime() { - return serverTime; - } - - public void setServerTime(String serverTime) { - this.serverTime = serverTime; - } - - public String getUptime() { - return uptime; - } - - public void setUptime(String uptime) { - this.uptime = uptime; - } - - public long getUptimeMillis() { - return uptimeMillis; - } - - public void setUptimeMillis(long uptimeMillis) { - this.uptimeMillis = uptimeMillis; - } - - public String getJavaVersion() { - return javaVersion; - } - - public void setJavaVersion(String javaVersion) { - this.javaVersion = javaVersion; - } - - public String getJavaVendor() { - return javaVendor; - } - - public void setJavaVendor(String javaVendor) { - this.javaVendor = javaVendor; - } - - public String getJavaVm() { - return javaVm; - } - - public void setJavaVm(String javaVm) { - this.javaVm = javaVm; - } - - public String getJavaVmVersion() { - return javaVmVersion; - } - - public void setJavaVmVersion(String javaVmVersion) { - this.javaVmVersion = javaVmVersion; - } - - public String getJavaRuntime() { - return javaRuntime; - } - - public void setJavaRuntime(String javaRuntime) { - this.javaRuntime = javaRuntime; - } - - public String getJavaHome() { - return javaHome; - } - - public void setJavaHome(String javaHome) { - this.javaHome = javaHome; - } - - public String getOsName() { - return osName; - } - - public void setOsName(String osName) { - this.osName = osName; - } - - public String getOsArchitecture() { - return osArchitecture; - } - - public void setOsArchitecture(String osArchitecture) { - this.osArchitecture = osArchitecture; - } - - public String getOsVersion() { - return osVersion; - } - - public void setOsVersion(String osVersion) { - this.osVersion = osVersion; - } - - public String getFileEncoding() { - return fileEncoding; - } - - public void setFileEncoding(String fileEncoding) { - this.fileEncoding = fileEncoding; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getUserDir() { - return userDir; - } - - public void setUserDir(String userDir) { - this.userDir = userDir; - } - - public String getUserTimezone() { - return userTimezone; - } - - public void setUserTimezone(String userTimezone) { - this.userTimezone = userTimezone; - } - - public String getUserLocale() { - return userLocale; - } - - public void setUserLocale(String userLocale) { - this.userLocale = userLocale; - } - - private static String formatUptime(long uptime) { - long diffInSeconds = uptime / 1000; - long diff[] = new long[]{0, 0, 0, 0}; // sec - diff[3] = (diffInSeconds >= 60 ? diffInSeconds % 60 : diffInSeconds); // min - diff[2] = (diffInSeconds = (diffInSeconds / 60)) >= 60 ? diffInSeconds % 60 : diffInSeconds; // hours - diff[1] = (diffInSeconds = (diffInSeconds / 60)) >= 24 ? diffInSeconds % 24 : diffInSeconds; // days - diff[0] = (diffInSeconds = (diffInSeconds / 24)); - - return String.format( - "%d day%s, %d hour%s, %d minute%s, %d second%s", - diff[0], - diff[0] != 1 ? "s" : "", - diff[1], - diff[1] != 1 ? "s" : "", - diff[2], - diff[2] != 1 ? "s" : "", - diff[3], - diff[3] != 1 ? "s" : ""); - } - -} diff --git a/authz-client/src/main/java/org/keycloak/representations/info/ThemeInfoRepresentation.java b/authz-client/src/main/java/org/keycloak/representations/info/ThemeInfoRepresentation.java deleted file mode 100644 index 7bf6b2d..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/info/ThemeInfoRepresentation.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - */ - -package org.keycloak.representations.info; - -/** - * @author Stian Thorgersen - */ -public class ThemeInfoRepresentation { - - private String name; - private String[] locales; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String[] getLocales() { - return locales; - } - - public void setLocales(String[] locales) { - this.locales = locales; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttribute.java b/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttribute.java deleted file mode 100644 index be01faf..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttribute.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright 2023 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.keycloak.representations.userprofile.config; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; - -/** - * Configuration of the Attribute. - * - * @author Vlastimil Elias - * - */ -public class UPAttribute implements Cloneable { - - private String name; - private String displayName; - /** key in the Map is name of the validator, value is its configuration */ - private Map> validations; - private Map annotations; - /** null means it is not required */ - private UPAttributeRequired required; - /** null means everyone can view and edit the attribute */ - private UPAttributePermissions permissions; - /** null means it is always selected */ - private UPAttributeSelector selector; - private String group; - private boolean multivalued; - - public UPAttribute() { - } - - public UPAttribute(String name) { - this.name = name != null ? name.trim() : null; - } - - public UPAttribute(String name, UPGroup group) { - this(name); - this.group = group.getName(); - } - - public UPAttribute(String name, UPAttributePermissions permissions, UPAttributeRequired required, UPAttributeSelector selector) { - this(name); - this.permissions = permissions; - this.required = required; - this.selector = selector; - } - - public UPAttribute(String name, UPAttributePermissions permissions, UPAttributeRequired required) { - this(name, permissions, required, null); - } - - public UPAttribute(String name, UPAttributePermissions permissions) { - this(name, permissions, null); - } - - public UPAttribute(String name, boolean multivalued, UPAttributePermissions permissions) { - this(name, permissions, null); - setMultivalued(multivalued); - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name != null ? name.trim() : null; - } - - public Map> getValidations() { - return validations; - } - - public void setValidations(Map> validations) { - this.validations = validations; - } - - public Map getAnnotations() { - return annotations; - } - - public void setAnnotations(Map annotations) { - this.annotations = annotations; - } - - public UPAttributeRequired getRequired() { - return required; - } - - public void setRequired(UPAttributeRequired required) { - this.required = required; - } - - public UPAttributePermissions getPermissions() { - return permissions; - } - - public void setPermissions(UPAttributePermissions permissions) { - this.permissions = permissions; - } - - public void addValidation(String validator, Map config) { - if (validations == null) { - validations = new HashMap<>(); - } - validations.put(validator, config); - } - - public UPAttributeSelector getSelector() { - return selector; - } - - public void setSelector(UPAttributeSelector selector) { - this.selector = selector; - } - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public String getGroup() { - return group; - } - - public void setGroup(String group) { - this.group = group != null ? group.trim() : null; - } - - public void setMultivalued(boolean multivalued) { - this.multivalued = multivalued; - } - - public boolean isMultivalued() { - return multivalued; - } - - @Override - public String toString() { - return "UPAttribute [name=" + name + ", displayName=" + displayName + ", permissions=" + permissions + ", selector=" + selector + ", required=" + required + ", validations=" + validations + ", annotations=" + annotations + ", group=" + group + ", multivalued=" + multivalued + "]"; - } - - @Override - protected UPAttribute clone() { - UPAttribute attr = new UPAttribute(this.name); - attr.setDisplayName(this.displayName); - - Map> validations; - if (this.validations == null) { - validations = null; - } else { - validations = new LinkedHashMap<>(); - for (Map.Entry> entry : this.validations.entrySet()) { - Map newVal = entry.getValue() == null ? null : new LinkedHashMap<>(entry.getValue()); - validations.put(entry.getKey(), newVal); - } - } - attr.setValidations(validations); - - attr.setAnnotations(this.annotations == null ? null : new HashMap<>(this.annotations)); - attr.setRequired(this.required == null ? null : this.required.clone()); - attr.setPermissions(this.permissions == null ? null : this.permissions.clone()); - attr.setSelector(this.selector == null ? null : this.selector.clone()); - attr.setGroup(this.group); - attr.setMultivalued(this.multivalued); - return attr; - } - - @Override - public int hashCode() { - return Objects.hash(name); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - final UPAttribute other = (UPAttribute) obj; - return Objects.equals(this.name, other.name) - && Objects.equals(this.displayName, other.displayName) - && Objects.equals(this.group, other.group) - && Objects.equals(this.validations, other.validations) - && Objects.equals(this.annotations, other.annotations) - && Objects.equals(this.required, other.required) - && Objects.equals(this.permissions, other.permissions) - && Objects.equals(this.selector, other.selector) - && Objects.equals(this.multivalued, other.multivalued); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributePermissions.java b/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributePermissions.java deleted file mode 100644 index 69841d6..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributePermissions.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2023 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.keycloak.representations.userprofile.config; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Objects; -import java.util.Set; -import com.fasterxml.jackson.annotation.JsonIgnore; - -/** - * Configuration of permissions for the attribute - * - * @author Vlastimil Elias - * - */ -public class UPAttributePermissions implements Cloneable { - - private Set view = Collections.emptySet(); - private Set edit = Collections.emptySet(); - - public UPAttributePermissions() { - // for reflection - } - - public UPAttributePermissions(Set view, Set edit) { - this.view = view; - this.edit = edit; - } - - public Set getView() { - return view; - } - - public void setView(Set view) { - this.view = view; - } - - public Set getEdit() { - return edit; - } - - public void setEdit(Set edit) { - this.edit = edit; - } - - @Override - public String toString() { - return "UPAttributePermissions [view=" + view + ", edit=" + edit + "]"; - } - - @JsonIgnore - public boolean isEmpty() { - return getEdit().isEmpty() && getView().isEmpty(); - } - - @Override - protected UPAttributePermissions clone() { - Set view = this.view == null ? null : new HashSet<>(this.view); - Set edit = this.edit == null ? null : new HashSet<>(this.edit); - return new UPAttributePermissions(view, edit); - } - - @Override - public int hashCode() { - return Objects.hash(view, edit); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - final UPAttributePermissions other = (UPAttributePermissions) obj; - return Objects.equals(this.view, other.view) - && Objects.equals(this.edit, other.edit); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributeRequired.java b/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributeRequired.java deleted file mode 100644 index a3027b0..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributeRequired.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2023 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.keycloak.representations.userprofile.config; - -import java.util.HashSet; -import java.util.Objects; -import java.util.Set; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -/** - * Config of the rules when attribute is required. - * - * @author Vlastimil Elias - * - */ -public class UPAttributeRequired implements Cloneable { - - private Set roles; - private Set scopes; - - public UPAttributeRequired() { - // for reflection - } - - public UPAttributeRequired(Set roles, Set scopes) { - this.roles = roles; - this.scopes = scopes; - } - - /** - * Check if this config means that the attribute is ALWAYS required. - * - * @return true if the attribute is always required - */ - @JsonIgnore - public boolean isAlways() { - return (roles == null || roles.isEmpty()) && (scopes == null || scopes.isEmpty()); - } - - public Set getRoles() { - return roles; - } - - public void setRoles(Set roles) { - this.roles = roles; - } - - public Set getScopes() { - return scopes; - } - - public void setScopes(Set scopes) { - this.scopes = scopes; - } - - - @Override - public String toString() { - return "UPAttributeRequired [isAlways=" + isAlways() + ", roles=" + roles + ", scopes=" + scopes + "]"; - } - - @Override - protected UPAttributeRequired clone() { - Set scopes = this.scopes == null ? null : new HashSet<>(this.scopes); - Set roles = this.roles == null ? null : new HashSet<>(this.roles); - return new UPAttributeRequired(roles, scopes); - } - - @Override - public int hashCode() { - return Objects.hash(roles, scopes); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - final UPAttributeRequired other = (UPAttributeRequired) obj; - return Objects.equals(this.roles, other.roles) - && Objects.equals(this.scopes, other.scopes); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributeSelector.java b/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributeSelector.java deleted file mode 100644 index fac2dbd..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributeSelector.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2023 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.keycloak.representations.userprofile.config; - -import java.util.HashSet; -import java.util.Objects; -import java.util.Set; - -/** - * Config of the rules when attribute is selected. - * - * @author Vlastimil Elias - * - */ -public class UPAttributeSelector implements Cloneable { - - private Set scopes; - - public UPAttributeSelector() { - // for reflection - } - - public UPAttributeSelector(Set scopes) { - this.scopes = scopes; - } - - public Set getScopes() { - return scopes; - } - - public void setScopes(Set scopes) { - this.scopes = scopes; - } - - @Override - public String toString() { - return "UPAttributeSelector [scopes=" + scopes + "]"; - } - - @Override - protected UPAttributeSelector clone() { - return new UPAttributeSelector(scopes == null ? null : new HashSet<>(scopes)); - } - - @Override - public int hashCode() { - return Objects.hash(scopes); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - final UPAttributeSelector other = (UPAttributeSelector) obj; - return Objects.equals(this.scopes, other.scopes); - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPConfig.java b/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPConfig.java deleted file mode 100644 index f417bf2..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPConfig.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 2023 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.keycloak.representations.userprofile.config; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -/** - * Configuration of the User Profile for one realm. - * - * @author Vlastimil Elias - * - */ -public class UPConfig implements Cloneable { - - public enum UnmanagedAttributePolicy { - - /** - * Unmanaged attributes are enabled and available from any context. - */ - ENABLED, - - /** - * Unmanaged attributes are only available as read-only and only through the management interfaces. - */ - ADMIN_VIEW, - - /** - * Unmanaged attributes are only available as read-write and only through the management interfaces. - */ - ADMIN_EDIT - } - - private List attributes; - private List groups; - - private UnmanagedAttributePolicy unmanagedAttributePolicy; - - public List getAttributes() { - return attributes; - } - - public void setAttributes(List attributes) { - this.attributes = attributes; - } - - public UPConfig addOrReplaceAttribute(UPAttribute attribute) { - if (attributes == null) { - attributes = new ArrayList<>(); - } - - removeAttribute(attribute.getName()); - attributes.add(attribute); - - return this; - } - - public boolean removeAttribute(String name) { - return attributes != null && attributes.removeIf(attribute -> attribute.getName().equals(name)); - } - - public List getGroups() { - if (groups == null) { - return Collections.emptyList(); - } - return groups; - } - - public void setGroups(List groups) { - this.groups = groups; - } - - public UPConfig addGroup(UPGroup group) { - if (groups == null) { - groups = new ArrayList<>(); - } - - groups.add(group); - - return this; - } - - @JsonIgnore - public UPAttribute getAttribute(String name) { - for (UPAttribute attribute : getAttributes()) { - if (attribute.getName().equals(name)) { - return attribute; - } - } - return null; - } - - public UnmanagedAttributePolicy getUnmanagedAttributePolicy() { - return unmanagedAttributePolicy; - } - - public void setUnmanagedAttributePolicy(UnmanagedAttributePolicy unmanagedAttributePolicy) { - this.unmanagedAttributePolicy = unmanagedAttributePolicy; - } - - @Override - public String toString() { - return "UPConfig [attributes=" + attributes + ", groups=" + groups + "]"; - } - - @Override - public UPConfig clone() { - UPConfig cfg = new UPConfig(); - - cfg.setUnmanagedAttributePolicy(this.unmanagedAttributePolicy); - if (attributes != null) { - cfg.setAttributes(attributes.stream().map(UPAttribute::clone).collect(Collectors.toList())); - } - if (groups != null) { - cfg.setGroups(groups.stream().map(UPGroup::clone).collect(Collectors.toList())); - } - - return cfg; - } - - @Override - public int hashCode() { - return Objects.hash(attributes, groups, unmanagedAttributePolicy); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - final UPConfig other = (UPConfig) obj; - return Objects.equals(this.attributes, other.attributes) - && Objects.equals(this.groups, other.groups) - && this.unmanagedAttributePolicy == other.unmanagedAttributePolicy; - } -} diff --git a/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPGroup.java b/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPGroup.java deleted file mode 100644 index fc768b0..0000000 --- a/authz-client/src/main/java/org/keycloak/representations/userprofile/config/UPGroup.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2023 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.keycloak.representations.userprofile.config; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** - * Configuration of the attribute group. - * - * @author Jörg Matysiak - */ -public class UPGroup implements Cloneable { - - private String name; - private String displayHeader; - private String displayDescription; - private Map annotations; - - public UPGroup() { - // for reflection - } - - public UPGroup(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name != null ? name.trim() : null; - } - - public String getDisplayHeader() { - return displayHeader; - } - - public void setDisplayHeader(String displayHeader) { - this.displayHeader = displayHeader; - } - - public String getDisplayDescription() { - return displayDescription; - } - - public void setDisplayDescription(String displayDescription) { - this.displayDescription = displayDescription; - } - - public Map getAnnotations() { - return annotations; - } - - public void setAnnotations(Map annotations) { - this.annotations = annotations; - } - - @Override - protected UPGroup clone() { - UPGroup group = new UPGroup(this.name); - group.setDisplayHeader(displayHeader); - group.setDisplayDescription(displayDescription); - group.setAnnotations(this.annotations == null ? null : new HashMap<>(this.annotations)); - return group; - } - - @Override - public int hashCode() { - return Objects.hash(name); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - final UPGroup other = (UPGroup) obj; - return Objects.equals(this.name, other.name) - && Objects.equals(this.displayHeader, other.displayHeader) - && Objects.equals(this.displayDescription, other.displayDescription) - && Objects.equals(this.annotations, other.annotations); - } -} diff --git a/authz-client/src/main/java/org/keycloak/util/BasicAuthHelper.java b/authz-client/src/main/java/org/keycloak/util/BasicAuthHelper.java deleted file mode 100755 index 9a6091f..0000000 --- a/authz-client/src/main/java/org/keycloak/util/BasicAuthHelper.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.util; - -import org.keycloak.common.util.Base64; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; - -/** - * The default implementation is compliant with RFC 2617 - * - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class BasicAuthHelper { - public static String createHeader(String username, String password) { - return "Basic " + Base64.encodeBytes((username + ':' + password).getBytes(StandardCharsets.UTF_8)); - } - - public static String[] parseHeader(String header) { - if (header.length() < 6) return null; - - String type = header.substring(0, 5); - type = type.toLowerCase(); - if (!type.equalsIgnoreCase("Basic")) return null; - - String val; - try { - val = new String(Base64.decode(header.substring(6))); - } catch (IOException e) { - return null; - } - - int separatorIndex = val.indexOf(":"); - if (separatorIndex == -1) return null; - - String username = val.substring(0, separatorIndex); - String password = val.substring(separatorIndex + 1); - - return new String[]{ username, password }; - } - - /** - * compliant with RFC 6749 - */ - public static abstract class RFC6749 { - - public static String createHeader(String username, String password) { - try { - return BasicAuthHelper.createHeader( - URLEncoder.encode(username, "UTF-8"), - URLEncoder.encode(password, "UTF-8") - ); - } catch (UnsupportedEncodingException e) { - return null; - } - } - - public static String[] parseHeader(String header) { - String[] val = BasicAuthHelper.parseHeader(header); - if (null == val) { - return null; - } - - try { - return new String[]{ - URLDecoder.decode(val[0], "UTF-8"), - URLDecoder.decode(val[1], "UTF-8") - }; - } catch (UnsupportedEncodingException e) { - return null; - } - } - } -} diff --git a/authz-client/src/main/java/org/keycloak/util/EnumWithStableIndex.java b/authz-client/src/main/java/org/keycloak/util/EnumWithStableIndex.java deleted file mode 100644 index f3b14a5..0000000 --- a/authz-client/src/main/java/org/keycloak/util/EnumWithStableIndex.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.util; - -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * Classes implementing this interface guarantee that for each instance of this class, - * there exists an mutually unique integer which is stable in time, and identifies - * always the same instance of this class. - * The index might be used for persistence, hence the index of a particular item - * cannot be changed. - * This is mostly usable for @{code enum}s. - */ -public interface EnumWithStableIndex { - /** - * @return Unique numeric index which is stable in time and identifies an instance. - * Reusing the same index for two distinct entries of the same class is forbidden even - * if they cannot exist at the same time (e.g. one is deleted before other is introduced). - */ - public int getStableIndex(); - - public static Map getReverseIndex(E[] values) { - return Stream.of(values).collect(Collectors.toMap(EnumWithStableIndex::getStableIndex, Function.identity())); - } -} diff --git a/authz-client/src/main/java/org/keycloak/util/JsonSerialization.java b/authz-client/src/main/java/org/keycloak/util/JsonSerialization.java deleted file mode 100755 index e87275d..0000000 --- a/authz-client/src/main/java/org/keycloak/util/JsonSerialization.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.util; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -/** - * Utility class to handle simple JSON serializable for Keycloak. - * - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class JsonSerialization { - public static final ObjectMapper mapper = new ObjectMapper(); - public static final ObjectMapper prettyMapper = new ObjectMapper(); - public static final ObjectMapper sysPropertiesAwareMapper = new ObjectMapper(new SystemPropertiesJsonParserFactory()); - - static { - mapper.registerModule(new Jdk8Module()); - mapper.registerModule(new JavaTimeModule()); - mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - prettyMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - prettyMapper.enable(SerializationFeature.INDENT_OUTPUT); - prettyMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - } - - public static void writeValueToStream(OutputStream os, Object obj) throws IOException { - mapper.writeValue(os, obj); - } - - public static void writeValuePrettyToStream(OutputStream os, Object obj) throws IOException { - prettyMapper.writeValue(os, obj); - } - - public static String writeValueAsPrettyString(Object obj) throws IOException { - return prettyMapper.writeValueAsString(obj); - } - public static String writeValueAsString(Object obj) throws IOException { - return mapper.writeValueAsString(obj); - } - - public static byte[] writeValueAsBytes(Object obj) throws IOException { - return mapper.writeValueAsBytes(obj); - } - - public static T readValue(byte[] bytes, Class type) throws IOException { - return mapper.readValue(bytes, type); - } - - public static T readValue(String bytes, Class type) throws IOException { - return mapper.readValue(bytes, type); - } - - public static T readValue(InputStream bytes, Class type) throws IOException { - return readValue(bytes, type, false); - } - - public static T readValue(String string, TypeReference type) throws IOException { - return mapper.readValue(string, type); - } - - public static T readValue(InputStream bytes, TypeReference type) throws IOException { - return mapper.readValue(bytes, type); - } - - public static T readValue(InputStream bytes, Class type, boolean replaceSystemProperties) throws IOException { - if (replaceSystemProperties) { - return sysPropertiesAwareMapper.readValue(bytes, type); - } else { - return mapper.readValue(bytes, type); - } - } - - /** - * Creates an {@link ObjectNode} based on the given {@code pojo}, copying all its properties to the resulting {@link ObjectNode}. - * - * @param pojo a pojo which properties will be populates into the resulting a {@link ObjectNode} - * @return a {@link ObjectNode} with all the properties from the given pojo - * @throws IOException if the resulting a {@link ObjectNode} can not be created - */ - public static ObjectNode createObjectNode(Object pojo) throws IOException { - if (pojo == null) { - throw new IllegalArgumentException("Pojo can not be null."); - } - - ObjectNode objectNode = createObjectNode(); - JsonParser jsonParser = mapper.getFactory().createParser(writeValueAsBytes(pojo)); - JsonNode jsonNode = jsonParser.readValueAsTree(); - - if (!jsonNode.isObject()) { - throw new RuntimeException("JsonNode [" + jsonNode + "] is not a object."); - } - - objectNode.setAll((ObjectNode) jsonNode); - - return objectNode; - } - - public static ObjectNode createObjectNode() { - return mapper.createObjectNode(); - } - -} diff --git a/authz-client/src/main/java/org/keycloak/util/SystemPropertiesJsonParserFactory.java b/authz-client/src/main/java/org/keycloak/util/SystemPropertiesJsonParserFactory.java deleted file mode 100644 index 10481fb..0000000 --- a/authz-client/src/main/java/org/keycloak/util/SystemPropertiesJsonParserFactory.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2016 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.util; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.io.IOContext; -import com.fasterxml.jackson.core.util.JsonParserDelegate; -import com.fasterxml.jackson.databind.MappingJsonFactory; -import org.keycloak.common.util.StringPropertyReplacer; -import org.keycloak.common.util.SystemEnvProperties; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.util.Properties; - -/** - * Provides replacing of system properties for parsed values - * - * @author Marek Posolda - */ -public class SystemPropertiesJsonParserFactory extends MappingJsonFactory { - - private static final Properties properties = new SystemEnvProperties(); - - @Override - protected JsonParser _createParser(InputStream in, IOContext ctxt) throws IOException { - JsonParser delegate = super._createParser(in, ctxt); - return new SystemPropertiesAwareJsonParser(delegate); - } - - @Override - protected JsonParser _createParser(Reader r, IOContext ctxt) throws IOException { - JsonParser delegate = super._createParser(r, ctxt); - return new SystemPropertiesAwareJsonParser(delegate); - } - - @Override - protected JsonParser _createParser(char[] data, int offset, int len, IOContext ctxt, boolean recyclable) throws IOException { - JsonParser delegate = super._createParser(data, offset, len, ctxt, recyclable); - return new SystemPropertiesAwareJsonParser(delegate); - } - - @Override - protected JsonParser _createParser(byte[] data, int offset, int len, IOContext ctxt) throws IOException { - JsonParser delegate = super._createParser(data, offset, len, ctxt); - return new SystemPropertiesAwareJsonParser(delegate); - } - - public static class SystemPropertiesAwareJsonParser extends JsonParserDelegate { - - public SystemPropertiesAwareJsonParser(JsonParser d) { - super(d); - } - - @Override - public String getText() throws IOException { - String orig = super.getText(); - return StringPropertyReplacer.replaceProperties(orig, properties); - } - } -} diff --git a/client-common-synced/pom.xml b/client-common-synced/pom.xml new file mode 100644 index 0000000..7fd3e78 --- /dev/null +++ b/client-common-synced/pom.xml @@ -0,0 +1,208 @@ + + + 4.0.0 + + + org.keycloak + keycloak-client-parent + 999.0.0-SNAPSHOT + ../pom.xml + + + keycloak-client-common-synced + jar + + Keycloak Client Common Synced + Keycloak Client Common Synced + + + + org.jboss.logging + jboss-logging + + + org.jboss.logging + commons-logging-jboss-logging + runtime + + + org.apache.httpcomponents + httpclient + + + + com.fasterxml.jackson.core + jackson-core + provided + + + com.fasterxml.jackson.core + jackson-databind + provided + + + com.fasterxml.jackson.core + jackson-annotations + provided + + + com.fasterxml.jackson.datatype + jackson-datatype-jdk8 + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + org.eclipse.microprofile.openapi + microprofile-openapi-api + + + jakarta.activation + jakarta.activation-api + + + + + + sync + + + + ${project.build.directory}/unpacked-resources + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack-keycloak-sources + generate-sources + + unpack + + + + + org.keycloak + keycloak-core + ${keycloak.version} + jar + sources + true + ${project.build.directory}/unpacked + + org/keycloak/OAuth2Constants.java, + org/keycloak/TokenCategory.java, + org/keycloak/Token.java, + org/keycloak/TokenIdGenerator.java, + org/keycloak/AuthorizationContext.java, + + org/keycloak/json/*.java, + + org/keycloak/representations/adapters/action/GlobalRequestResult.java, + org/keycloak/representations/idm/**/*.java, + org/keycloak/representations/info/*.java, + org/keycloak/representations/userprofile/config/*.java, + org/keycloak/representations/AccessToken.java, + org/keycloak/representations/AccessTokenResponse.java, + org/keycloak/representations/AddressClaimSet.java, + org/keycloak/representations/IDToken.java, + org/keycloak/representations/JsonWebToken.java, + org/keycloak/representations/KeyStoreConfig.java, + org/keycloak/representations/adapters/config/*.java, + org/keycloak/representations/RefreshToken.java, + + org/keycloak/util/BasicAuthHelper.java, + org/keycloak/util/EnumWithStableIndex.java, + org/keycloak/util/JsonSerialization.java, + org/keycloak/util/SystemPropertiesJsonParserFactory.java, + org/keycloak/util/TokenUtil.java, + + org/keycloak/jose/JOSE.java, + org/keycloak/jose/JOSEHeader.java, + org/keycloak/jose/jwe/**/*.java, + org/keycloak/jose/jws/**/*.java, + org/keycloak/jose/jwk/**/*.java, + + org/keycloak/crypto/**/*.java, + + org/keycloak/protocol/oidc/client/authentication/*.java, + + org/keycloak/constants/ServiceUrlConstants.java, + + + + + org.keycloak + keycloak-core + ${keycloak.version} + jar + sources + true + ${project.build.directory}/unpacked-resources + + META-INF/services/**/* + + + + org.keycloak + keycloak-common + ${keycloak.version} + jar + sources + true + ${project.build.directory}/unpacked + + org/keycloak/common/**/*.java + + + org/keycloak/common/Version.java + + + + org.keycloak + keycloak-server-spi + ${keycloak.version} + jar + sources + true + ${project.build.directory}/unpacked + + org/keycloak/utils/StringUtil.java, + + + + false + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + ${project.build.directory}/unpacked + + + + + + + + + + + diff --git a/authz-client/src/main/java/org/keycloak/AuthorizationContext.java b/client-common-synced/src/main/java/org/keycloak/AuthorizationContext.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/AuthorizationContext.java rename to client-common-synced/src/main/java/org/keycloak/AuthorizationContext.java diff --git a/admin-client/src/main/java/org/keycloak/OAuth2Constants.java b/client-common-synced/src/main/java/org/keycloak/OAuth2Constants.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/OAuth2Constants.java rename to client-common-synced/src/main/java/org/keycloak/OAuth2Constants.java diff --git a/admin-client/src/main/java/org/keycloak/Token.java b/client-common-synced/src/main/java/org/keycloak/Token.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/Token.java rename to client-common-synced/src/main/java/org/keycloak/Token.java diff --git a/admin-client/src/main/java/org/keycloak/TokenCategory.java b/client-common-synced/src/main/java/org/keycloak/TokenCategory.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/TokenCategory.java rename to client-common-synced/src/main/java/org/keycloak/TokenCategory.java diff --git a/admin-client/src/main/java/org/keycloak/TokenIdGenerator.java b/client-common-synced/src/main/java/org/keycloak/TokenIdGenerator.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/TokenIdGenerator.java rename to client-common-synced/src/main/java/org/keycloak/TokenIdGenerator.java diff --git a/authz-client/src/main/java/org/keycloak/common/ClientConnection.java b/client-common-synced/src/main/java/org/keycloak/common/ClientConnection.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/ClientConnection.java rename to client-common-synced/src/main/java/org/keycloak/common/ClientConnection.java diff --git a/authz-client/src/main/java/org/keycloak/common/Profile.java b/client-common-synced/src/main/java/org/keycloak/common/Profile.java similarity index 98% rename from authz-client/src/main/java/org/keycloak/common/Profile.java rename to client-common-synced/src/main/java/org/keycloak/common/Profile.java index 7d87f6e..6d64678 100755 --- a/authz-client/src/main/java/org/keycloak/common/Profile.java +++ b/client-common-synced/src/main/java/org/keycloak/common/Profile.java @@ -108,18 +108,21 @@ public enum Feature { CLIENT_TYPES("Client Types", Type.EXPERIMENTAL), - HOSTNAME_V1("Hostname Options V1", Type.DEPRECATED, 1), HOSTNAME_V2("Hostname Options V2", Type.DEFAULT, 2), - PERSISTENT_USER_SESSIONS("Persistent online user sessions across restarts and upgrades", Type.PREVIEW), + PERSISTENT_USER_SESSIONS("Persistent online user sessions across restarts and upgrades", Type.DEFAULT), OID4VC_VCI("Support for the OID4VCI protocol as part of OID4VC.", Type.EXPERIMENTAL), + OPENTELEMETRY("OpenTelemetry Tracing", Type.PREVIEW), + DECLARATIVE_UI("declarative ui spi", Type.EXPERIMENTAL), ORGANIZATION("Organization support within realms", Type.PREVIEW), - PASSKEYS("Passkeys", Type.PREVIEW) + PASSKEYS("Passkeys", Type.PREVIEW), + + CACHE_EMBEDDED_REMOTE_STORE("Support for remote-store in embedded Infinispan caches", Type.EXPERIMENTAL), ; private final Type type; diff --git a/authz-client/src/main/java/org/keycloak/common/VerificationException.java b/client-common-synced/src/main/java/org/keycloak/common/VerificationException.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/VerificationException.java rename to client-common-synced/src/main/java/org/keycloak/common/VerificationException.java diff --git a/authz-client/src/main/java/org/keycloak/common/constants/GenericConstants.java b/client-common-synced/src/main/java/org/keycloak/common/constants/GenericConstants.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/constants/GenericConstants.java rename to client-common-synced/src/main/java/org/keycloak/common/constants/GenericConstants.java diff --git a/authz-client/src/main/java/org/keycloak/common/constants/KerberosConstants.java b/client-common-synced/src/main/java/org/keycloak/common/constants/KerberosConstants.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/constants/KerberosConstants.java rename to client-common-synced/src/main/java/org/keycloak/common/constants/KerberosConstants.java diff --git a/admin-client/src/main/java/org/keycloak/common/constants/ServiceAccountConstants.java b/client-common-synced/src/main/java/org/keycloak/common/constants/ServiceAccountConstants.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/common/constants/ServiceAccountConstants.java rename to client-common-synced/src/main/java/org/keycloak/common/constants/ServiceAccountConstants.java diff --git a/authz-client/src/main/java/org/keycloak/common/crypto/CertificateUtilsProvider.java b/client-common-synced/src/main/java/org/keycloak/common/crypto/CertificateUtilsProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/crypto/CertificateUtilsProvider.java rename to client-common-synced/src/main/java/org/keycloak/common/crypto/CertificateUtilsProvider.java diff --git a/admin-client/src/main/java/org/keycloak/common/crypto/CryptoConstants.java b/client-common-synced/src/main/java/org/keycloak/common/crypto/CryptoConstants.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/common/crypto/CryptoConstants.java rename to client-common-synced/src/main/java/org/keycloak/common/crypto/CryptoConstants.java diff --git a/authz-client/src/main/java/org/keycloak/common/crypto/CryptoIntegration.java b/client-common-synced/src/main/java/org/keycloak/common/crypto/CryptoIntegration.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/crypto/CryptoIntegration.java rename to client-common-synced/src/main/java/org/keycloak/common/crypto/CryptoIntegration.java diff --git a/authz-client/src/main/java/org/keycloak/common/crypto/CryptoProvider.java b/client-common-synced/src/main/java/org/keycloak/common/crypto/CryptoProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/crypto/CryptoProvider.java rename to client-common-synced/src/main/java/org/keycloak/common/crypto/CryptoProvider.java diff --git a/authz-client/src/main/java/org/keycloak/common/crypto/ECDSACryptoProvider.java b/client-common-synced/src/main/java/org/keycloak/common/crypto/ECDSACryptoProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/crypto/ECDSACryptoProvider.java rename to client-common-synced/src/main/java/org/keycloak/common/crypto/ECDSACryptoProvider.java diff --git a/authz-client/src/main/java/org/keycloak/common/crypto/FipsMode.java b/client-common-synced/src/main/java/org/keycloak/common/crypto/FipsMode.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/crypto/FipsMode.java rename to client-common-synced/src/main/java/org/keycloak/common/crypto/FipsMode.java diff --git a/authz-client/src/main/java/org/keycloak/common/crypto/PemUtilsProvider.java b/client-common-synced/src/main/java/org/keycloak/common/crypto/PemUtilsProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/crypto/PemUtilsProvider.java rename to client-common-synced/src/main/java/org/keycloak/common/crypto/PemUtilsProvider.java diff --git a/authz-client/src/main/java/org/keycloak/common/crypto/UserIdentityExtractor.java b/client-common-synced/src/main/java/org/keycloak/common/crypto/UserIdentityExtractor.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/crypto/UserIdentityExtractor.java rename to client-common-synced/src/main/java/org/keycloak/common/crypto/UserIdentityExtractor.java diff --git a/authz-client/src/main/java/org/keycloak/common/crypto/UserIdentityExtractorProvider.java b/client-common-synced/src/main/java/org/keycloak/common/crypto/UserIdentityExtractorProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/crypto/UserIdentityExtractorProvider.java rename to client-common-synced/src/main/java/org/keycloak/common/crypto/UserIdentityExtractorProvider.java diff --git a/authz-client/src/main/java/org/keycloak/common/enums/AccountRestApiVersion.java b/client-common-synced/src/main/java/org/keycloak/common/enums/AccountRestApiVersion.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/enums/AccountRestApiVersion.java rename to client-common-synced/src/main/java/org/keycloak/common/enums/AccountRestApiVersion.java diff --git a/authz-client/src/main/java/org/keycloak/common/enums/HostnameVerificationPolicy.java b/client-common-synced/src/main/java/org/keycloak/common/enums/HostnameVerificationPolicy.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/enums/HostnameVerificationPolicy.java rename to client-common-synced/src/main/java/org/keycloak/common/enums/HostnameVerificationPolicy.java diff --git a/authz-client/src/main/java/org/keycloak/common/enums/RelativeUrlsUsed.java b/client-common-synced/src/main/java/org/keycloak/common/enums/RelativeUrlsUsed.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/enums/RelativeUrlsUsed.java rename to client-common-synced/src/main/java/org/keycloak/common/enums/RelativeUrlsUsed.java diff --git a/authz-client/src/main/java/org/keycloak/common/enums/SslRequired.java b/client-common-synced/src/main/java/org/keycloak/common/enums/SslRequired.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/enums/SslRequired.java rename to client-common-synced/src/main/java/org/keycloak/common/enums/SslRequired.java diff --git a/authz-client/src/main/java/org/keycloak/common/profile/CommaSeparatedListProfileConfigResolver.java b/client-common-synced/src/main/java/org/keycloak/common/profile/CommaSeparatedListProfileConfigResolver.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/profile/CommaSeparatedListProfileConfigResolver.java rename to client-common-synced/src/main/java/org/keycloak/common/profile/CommaSeparatedListProfileConfigResolver.java diff --git a/authz-client/src/main/java/org/keycloak/common/profile/ProfileConfigResolver.java b/client-common-synced/src/main/java/org/keycloak/common/profile/ProfileConfigResolver.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/profile/ProfileConfigResolver.java rename to client-common-synced/src/main/java/org/keycloak/common/profile/ProfileConfigResolver.java diff --git a/authz-client/src/main/java/org/keycloak/common/profile/ProfileException.java b/client-common-synced/src/main/java/org/keycloak/common/profile/ProfileException.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/profile/ProfileException.java rename to client-common-synced/src/main/java/org/keycloak/common/profile/ProfileException.java diff --git a/authz-client/src/main/java/org/keycloak/common/profile/PropertiesFileProfileConfigResolver.java b/client-common-synced/src/main/java/org/keycloak/common/profile/PropertiesFileProfileConfigResolver.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/profile/PropertiesFileProfileConfigResolver.java rename to client-common-synced/src/main/java/org/keycloak/common/profile/PropertiesFileProfileConfigResolver.java diff --git a/authz-client/src/main/java/org/keycloak/common/profile/PropertiesProfileConfigResolver.java b/client-common-synced/src/main/java/org/keycloak/common/profile/PropertiesProfileConfigResolver.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/profile/PropertiesProfileConfigResolver.java rename to client-common-synced/src/main/java/org/keycloak/common/profile/PropertiesProfileConfigResolver.java diff --git a/admin-client/src/main/java/org/keycloak/common/util/Base64.java b/client-common-synced/src/main/java/org/keycloak/common/util/Base64.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/common/util/Base64.java rename to client-common-synced/src/main/java/org/keycloak/common/util/Base64.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/Base64Url.java b/client-common-synced/src/main/java/org/keycloak/common/util/Base64Url.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/Base64Url.java rename to client-common-synced/src/main/java/org/keycloak/common/util/Base64Url.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/BouncyIntegration.java b/client-common-synced/src/main/java/org/keycloak/common/util/BouncyIntegration.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/BouncyIntegration.java rename to client-common-synced/src/main/java/org/keycloak/common/util/BouncyIntegration.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/CertificateUtils.java b/client-common-synced/src/main/java/org/keycloak/common/util/CertificateUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/CertificateUtils.java rename to client-common-synced/src/main/java/org/keycloak/common/util/CertificateUtils.java diff --git a/admin-client/src/main/java/org/keycloak/common/util/CollectionUtil.java b/client-common-synced/src/main/java/org/keycloak/common/util/CollectionUtil.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/common/util/CollectionUtil.java rename to client-common-synced/src/main/java/org/keycloak/common/util/CollectionUtil.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/ConcurrentMultivaluedHashMap.java b/client-common-synced/src/main/java/org/keycloak/common/util/ConcurrentMultivaluedHashMap.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/ConcurrentMultivaluedHashMap.java rename to client-common-synced/src/main/java/org/keycloak/common/util/ConcurrentMultivaluedHashMap.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/DelegatingSerializationFilter.java b/client-common-synced/src/main/java/org/keycloak/common/util/DelegatingSerializationFilter.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/DelegatingSerializationFilter.java rename to client-common-synced/src/main/java/org/keycloak/common/util/DelegatingSerializationFilter.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/DerUtils.java b/client-common-synced/src/main/java/org/keycloak/common/util/DerUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/DerUtils.java rename to client-common-synced/src/main/java/org/keycloak/common/util/DerUtils.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/Encode.java b/client-common-synced/src/main/java/org/keycloak/common/util/Encode.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/Encode.java rename to client-common-synced/src/main/java/org/keycloak/common/util/Encode.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/EnvUtil.java b/client-common-synced/src/main/java/org/keycloak/common/util/EnvUtil.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/EnvUtil.java rename to client-common-synced/src/main/java/org/keycloak/common/util/EnvUtil.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/Environment.java b/client-common-synced/src/main/java/org/keycloak/common/util/Environment.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/Environment.java rename to client-common-synced/src/main/java/org/keycloak/common/util/Environment.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/FindFile.java b/client-common-synced/src/main/java/org/keycloak/common/util/FindFile.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/FindFile.java rename to client-common-synced/src/main/java/org/keycloak/common/util/FindFile.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/HostUtils.java b/client-common-synced/src/main/java/org/keycloak/common/util/HostUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/HostUtils.java rename to client-common-synced/src/main/java/org/keycloak/common/util/HostUtils.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/HtmlUtils.java b/client-common-synced/src/main/java/org/keycloak/common/util/HtmlUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/HtmlUtils.java rename to client-common-synced/src/main/java/org/keycloak/common/util/HtmlUtils.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/HttpPostRedirect.java b/client-common-synced/src/main/java/org/keycloak/common/util/HttpPostRedirect.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/HttpPostRedirect.java rename to client-common-synced/src/main/java/org/keycloak/common/util/HttpPostRedirect.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/IoUtils.java b/client-common-synced/src/main/java/org/keycloak/common/util/IoUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/IoUtils.java rename to client-common-synced/src/main/java/org/keycloak/common/util/IoUtils.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/KerberosJdkProvider.java b/client-common-synced/src/main/java/org/keycloak/common/util/KerberosJdkProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/KerberosJdkProvider.java rename to client-common-synced/src/main/java/org/keycloak/common/util/KerberosJdkProvider.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/KerberosSerializationUtils.java b/client-common-synced/src/main/java/org/keycloak/common/util/KerberosSerializationUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/KerberosSerializationUtils.java rename to client-common-synced/src/main/java/org/keycloak/common/util/KerberosSerializationUtils.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/KeyUtils.java b/client-common-synced/src/main/java/org/keycloak/common/util/KeyUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/KeyUtils.java rename to client-common-synced/src/main/java/org/keycloak/common/util/KeyUtils.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/KeycloakUriBuilder.java b/client-common-synced/src/main/java/org/keycloak/common/util/KeycloakUriBuilder.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/KeycloakUriBuilder.java rename to client-common-synced/src/main/java/org/keycloak/common/util/KeycloakUriBuilder.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/KeystoreUtil.java b/client-common-synced/src/main/java/org/keycloak/common/util/KeystoreUtil.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/KeystoreUtil.java rename to client-common-synced/src/main/java/org/keycloak/common/util/KeystoreUtil.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/MimeTypeUtil.java b/client-common-synced/src/main/java/org/keycloak/common/util/MimeTypeUtil.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/MimeTypeUtil.java rename to client-common-synced/src/main/java/org/keycloak/common/util/MimeTypeUtil.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/MultiSiteUtils.java b/client-common-synced/src/main/java/org/keycloak/common/util/MultiSiteUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/MultiSiteUtils.java rename to client-common-synced/src/main/java/org/keycloak/common/util/MultiSiteUtils.java diff --git a/admin-client/src/main/java/org/keycloak/common/util/MultivaluedHashMap.java b/client-common-synced/src/main/java/org/keycloak/common/util/MultivaluedHashMap.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/common/util/MultivaluedHashMap.java rename to client-common-synced/src/main/java/org/keycloak/common/util/MultivaluedHashMap.java diff --git a/admin-client/src/main/java/org/keycloak/common/util/MultivaluedMap.java b/client-common-synced/src/main/java/org/keycloak/common/util/MultivaluedMap.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/common/util/MultivaluedMap.java rename to client-common-synced/src/main/java/org/keycloak/common/util/MultivaluedMap.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/NetworkUtils.java b/client-common-synced/src/main/java/org/keycloak/common/util/NetworkUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/NetworkUtils.java rename to client-common-synced/src/main/java/org/keycloak/common/util/NetworkUtils.java diff --git a/admin-client/src/main/java/org/keycloak/common/util/ObjectUtil.java b/client-common-synced/src/main/java/org/keycloak/common/util/ObjectUtil.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/common/util/ObjectUtil.java rename to client-common-synced/src/main/java/org/keycloak/common/util/ObjectUtil.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/PaddingUtils.java b/client-common-synced/src/main/java/org/keycloak/common/util/PaddingUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/PaddingUtils.java rename to client-common-synced/src/main/java/org/keycloak/common/util/PaddingUtils.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/PathHelper.java b/client-common-synced/src/main/java/org/keycloak/common/util/PathHelper.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/PathHelper.java rename to client-common-synced/src/main/java/org/keycloak/common/util/PathHelper.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/PathMatcher.java b/client-common-synced/src/main/java/org/keycloak/common/util/PathMatcher.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/PathMatcher.java rename to client-common-synced/src/main/java/org/keycloak/common/util/PathMatcher.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/PemException.java b/client-common-synced/src/main/java/org/keycloak/common/util/PemException.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/PemException.java rename to client-common-synced/src/main/java/org/keycloak/common/util/PemException.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/PemUtils.java b/client-common-synced/src/main/java/org/keycloak/common/util/PemUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/PemUtils.java rename to client-common-synced/src/main/java/org/keycloak/common/util/PemUtils.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/Resteasy.java b/client-common-synced/src/main/java/org/keycloak/common/util/Resteasy.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/Resteasy.java rename to client-common-synced/src/main/java/org/keycloak/common/util/Resteasy.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/Retry.java b/client-common-synced/src/main/java/org/keycloak/common/util/Retry.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/Retry.java rename to client-common-synced/src/main/java/org/keycloak/common/util/Retry.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/SecretGenerator.java b/client-common-synced/src/main/java/org/keycloak/common/util/SecretGenerator.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/SecretGenerator.java rename to client-common-synced/src/main/java/org/keycloak/common/util/SecretGenerator.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/StackUtil.java b/client-common-synced/src/main/java/org/keycloak/common/util/StackUtil.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/StackUtil.java rename to client-common-synced/src/main/java/org/keycloak/common/util/StackUtil.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/StreamUtil.java b/client-common-synced/src/main/java/org/keycloak/common/util/StreamUtil.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/StreamUtil.java rename to client-common-synced/src/main/java/org/keycloak/common/util/StreamUtil.java diff --git a/admin-client/src/main/java/org/keycloak/common/util/StringPropertyReplacer.java b/client-common-synced/src/main/java/org/keycloak/common/util/StringPropertyReplacer.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/common/util/StringPropertyReplacer.java rename to client-common-synced/src/main/java/org/keycloak/common/util/StringPropertyReplacer.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/StringSerialization.java b/client-common-synced/src/main/java/org/keycloak/common/util/StringSerialization.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/StringSerialization.java rename to client-common-synced/src/main/java/org/keycloak/common/util/StringSerialization.java diff --git a/admin-client/src/main/java/org/keycloak/common/util/SystemEnvProperties.java b/client-common-synced/src/main/java/org/keycloak/common/util/SystemEnvProperties.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/common/util/SystemEnvProperties.java rename to client-common-synced/src/main/java/org/keycloak/common/util/SystemEnvProperties.java diff --git a/admin-client/src/main/java/org/keycloak/common/util/Time.java b/client-common-synced/src/main/java/org/keycloak/common/util/Time.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/common/util/Time.java rename to client-common-synced/src/main/java/org/keycloak/common/util/Time.java diff --git a/authz-client/src/main/java/org/keycloak/representations/idm/MembershipType.java b/client-common-synced/src/main/java/org/keycloak/common/util/TriFunction.java similarity index 66% rename from authz-client/src/main/java/org/keycloak/representations/idm/MembershipType.java rename to client-common-synced/src/main/java/org/keycloak/common/util/TriFunction.java index 5c89d4e..2b9391e 100644 --- a/authz-client/src/main/java/org/keycloak/representations/idm/MembershipType.java +++ b/client-common-synced/src/main/java/org/keycloak/common/util/TriFunction.java @@ -14,17 +14,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.keycloak.representations.idm; -public enum MembershipType { +package org.keycloak.common.util; - /** - * Indicates that member can exist without group/organization. - */ - UNMANAGED, +@FunctionalInterface +public interface TriFunction { /** - * Indicates that member cannot exist without group/organization. + * Applies this function to the given arguments. + * + * @param t the first function argument + * @param u the second function argument + * @param v the third function argument + * @return the function result */ - MANAGED; + R apply(T t, U u, V v); + } diff --git a/authz-client/src/main/java/org/keycloak/common/util/UriUtils.java b/client-common-synced/src/main/java/org/keycloak/common/util/UriUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/UriUtils.java rename to client-common-synced/src/main/java/org/keycloak/common/util/UriUtils.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/reflections/Reflections.java b/client-common-synced/src/main/java/org/keycloak/common/util/reflections/Reflections.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/reflections/Reflections.java rename to client-common-synced/src/main/java/org/keycloak/common/util/reflections/Reflections.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/reflections/SetAccessiblePrivilegedAction.java b/client-common-synced/src/main/java/org/keycloak/common/util/reflections/SetAccessiblePrivilegedAction.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/reflections/SetAccessiblePrivilegedAction.java rename to client-common-synced/src/main/java/org/keycloak/common/util/reflections/SetAccessiblePrivilegedAction.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/reflections/Types.java b/client-common-synced/src/main/java/org/keycloak/common/util/reflections/Types.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/reflections/Types.java rename to client-common-synced/src/main/java/org/keycloak/common/util/reflections/Types.java diff --git a/authz-client/src/main/java/org/keycloak/common/util/reflections/UnSetAccessiblePrivilegedAction.java b/client-common-synced/src/main/java/org/keycloak/common/util/reflections/UnSetAccessiblePrivilegedAction.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/common/util/reflections/UnSetAccessiblePrivilegedAction.java rename to client-common-synced/src/main/java/org/keycloak/common/util/reflections/UnSetAccessiblePrivilegedAction.java diff --git a/authz-client/src/main/java/org/keycloak/constants/ServiceUrlConstants.java b/client-common-synced/src/main/java/org/keycloak/constants/ServiceUrlConstants.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/constants/ServiceUrlConstants.java rename to client-common-synced/src/main/java/org/keycloak/constants/ServiceUrlConstants.java diff --git a/admin-client/src/main/java/org/keycloak/crypto/Algorithm.java b/client-common-synced/src/main/java/org/keycloak/crypto/Algorithm.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/crypto/Algorithm.java rename to client-common-synced/src/main/java/org/keycloak/crypto/Algorithm.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/AsymmetricSignatureSignerContext.java b/client-common-synced/src/main/java/org/keycloak/crypto/AsymmetricSignatureSignerContext.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/AsymmetricSignatureSignerContext.java rename to client-common-synced/src/main/java/org/keycloak/crypto/AsymmetricSignatureSignerContext.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/AsymmetricSignatureVerifierContext.java b/client-common-synced/src/main/java/org/keycloak/crypto/AsymmetricSignatureVerifierContext.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/AsymmetricSignatureVerifierContext.java rename to client-common-synced/src/main/java/org/keycloak/crypto/AsymmetricSignatureVerifierContext.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/ECDSAAlgorithm.java b/client-common-synced/src/main/java/org/keycloak/crypto/ECDSAAlgorithm.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/ECDSAAlgorithm.java rename to client-common-synced/src/main/java/org/keycloak/crypto/ECDSAAlgorithm.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/ECDSASignatureSignerContext.java b/client-common-synced/src/main/java/org/keycloak/crypto/ECDSASignatureSignerContext.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/ECDSASignatureSignerContext.java rename to client-common-synced/src/main/java/org/keycloak/crypto/ECDSASignatureSignerContext.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/ECDSASignatureVerifierContext.java b/client-common-synced/src/main/java/org/keycloak/crypto/ECDSASignatureVerifierContext.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/ECDSASignatureVerifierContext.java rename to client-common-synced/src/main/java/org/keycloak/crypto/ECDSASignatureVerifierContext.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/HashException.java b/client-common-synced/src/main/java/org/keycloak/crypto/HashException.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/HashException.java rename to client-common-synced/src/main/java/org/keycloak/crypto/HashException.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/JavaAlgorithm.java b/client-common-synced/src/main/java/org/keycloak/crypto/JavaAlgorithm.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/JavaAlgorithm.java rename to client-common-synced/src/main/java/org/keycloak/crypto/JavaAlgorithm.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/KeyStatus.java b/client-common-synced/src/main/java/org/keycloak/crypto/KeyStatus.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/KeyStatus.java rename to client-common-synced/src/main/java/org/keycloak/crypto/KeyStatus.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/KeyType.java b/client-common-synced/src/main/java/org/keycloak/crypto/KeyType.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/KeyType.java rename to client-common-synced/src/main/java/org/keycloak/crypto/KeyType.java diff --git a/admin-client/src/main/java/org/keycloak/crypto/KeyUse.java b/client-common-synced/src/main/java/org/keycloak/crypto/KeyUse.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/crypto/KeyUse.java rename to client-common-synced/src/main/java/org/keycloak/crypto/KeyUse.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/KeyWrapper.java b/client-common-synced/src/main/java/org/keycloak/crypto/KeyWrapper.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/KeyWrapper.java rename to client-common-synced/src/main/java/org/keycloak/crypto/KeyWrapper.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/MacSignatureSignerContext.java b/client-common-synced/src/main/java/org/keycloak/crypto/MacSignatureSignerContext.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/MacSignatureSignerContext.java rename to client-common-synced/src/main/java/org/keycloak/crypto/MacSignatureSignerContext.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/MacSignatureVerifierContext.java b/client-common-synced/src/main/java/org/keycloak/crypto/MacSignatureVerifierContext.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/MacSignatureVerifierContext.java rename to client-common-synced/src/main/java/org/keycloak/crypto/MacSignatureVerifierContext.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/PublicKeysWrapper.java b/client-common-synced/src/main/java/org/keycloak/crypto/PublicKeysWrapper.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/PublicKeysWrapper.java rename to client-common-synced/src/main/java/org/keycloak/crypto/PublicKeysWrapper.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/SignatureException.java b/client-common-synced/src/main/java/org/keycloak/crypto/SignatureException.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/SignatureException.java rename to client-common-synced/src/main/java/org/keycloak/crypto/SignatureException.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/SignatureSignerContext.java b/client-common-synced/src/main/java/org/keycloak/crypto/SignatureSignerContext.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/SignatureSignerContext.java rename to client-common-synced/src/main/java/org/keycloak/crypto/SignatureSignerContext.java diff --git a/authz-client/src/main/java/org/keycloak/crypto/SignatureVerifierContext.java b/client-common-synced/src/main/java/org/keycloak/crypto/SignatureVerifierContext.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/crypto/SignatureVerifierContext.java rename to client-common-synced/src/main/java/org/keycloak/crypto/SignatureVerifierContext.java diff --git a/authz-client/src/main/java/org/keycloak/jose/JOSE.java b/client-common-synced/src/main/java/org/keycloak/jose/JOSE.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/JOSE.java rename to client-common-synced/src/main/java/org/keycloak/jose/JOSE.java diff --git a/authz-client/src/main/java/org/keycloak/jose/JOSEHeader.java b/client-common-synced/src/main/java/org/keycloak/jose/JOSEHeader.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/JOSEHeader.java rename to client-common-synced/src/main/java/org/keycloak/jose/JOSEHeader.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwe/JWE.java b/client-common-synced/src/main/java/org/keycloak/jose/jwe/JWE.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwe/JWE.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwe/JWE.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwe/JWEConstants.java b/client-common-synced/src/main/java/org/keycloak/jose/jwe/JWEConstants.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwe/JWEConstants.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwe/JWEConstants.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwe/JWEException.java b/client-common-synced/src/main/java/org/keycloak/jose/jwe/JWEException.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwe/JWEException.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwe/JWEException.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwe/JWEHeader.java b/client-common-synced/src/main/java/org/keycloak/jose/jwe/JWEHeader.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwe/JWEHeader.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwe/JWEHeader.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwe/JWEKeyStorage.java b/client-common-synced/src/main/java/org/keycloak/jose/jwe/JWEKeyStorage.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwe/JWEKeyStorage.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwe/JWEKeyStorage.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwe/JWERegistry.java b/client-common-synced/src/main/java/org/keycloak/jose/jwe/JWERegistry.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwe/JWERegistry.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwe/JWERegistry.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwe/JWEUtils.java b/client-common-synced/src/main/java/org/keycloak/jose/jwe/JWEUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwe/JWEUtils.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwe/JWEUtils.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwe/alg/DirectAlgorithmProvider.java b/client-common-synced/src/main/java/org/keycloak/jose/jwe/alg/DirectAlgorithmProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwe/alg/DirectAlgorithmProvider.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwe/alg/DirectAlgorithmProvider.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwe/alg/JWEAlgorithmProvider.java b/client-common-synced/src/main/java/org/keycloak/jose/jwe/alg/JWEAlgorithmProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwe/alg/JWEAlgorithmProvider.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwe/alg/JWEAlgorithmProvider.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwe/enc/AesCbcHmacShaEncryptionProvider.java b/client-common-synced/src/main/java/org/keycloak/jose/jwe/enc/AesCbcHmacShaEncryptionProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwe/enc/AesCbcHmacShaEncryptionProvider.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwe/enc/AesCbcHmacShaEncryptionProvider.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwe/enc/AesCbcHmacShaJWEEncryptionProvider.java b/client-common-synced/src/main/java/org/keycloak/jose/jwe/enc/AesCbcHmacShaJWEEncryptionProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwe/enc/AesCbcHmacShaJWEEncryptionProvider.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwe/enc/AesCbcHmacShaJWEEncryptionProvider.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwe/enc/AesGcmEncryptionProvider.java b/client-common-synced/src/main/java/org/keycloak/jose/jwe/enc/AesGcmEncryptionProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwe/enc/AesGcmEncryptionProvider.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwe/enc/AesGcmEncryptionProvider.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwe/enc/AesGcmJWEEncryptionProvider.java b/client-common-synced/src/main/java/org/keycloak/jose/jwe/enc/AesGcmJWEEncryptionProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwe/enc/AesGcmJWEEncryptionProvider.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwe/enc/AesGcmJWEEncryptionProvider.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwe/enc/JWEEncryptionProvider.java b/client-common-synced/src/main/java/org/keycloak/jose/jwe/enc/JWEEncryptionProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwe/enc/JWEEncryptionProvider.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwe/enc/JWEEncryptionProvider.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwk/AbstractJWKBuilder.java b/client-common-synced/src/main/java/org/keycloak/jose/jwk/AbstractJWKBuilder.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwk/AbstractJWKBuilder.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwk/AbstractJWKBuilder.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwk/AbstractJWKParser.java b/client-common-synced/src/main/java/org/keycloak/jose/jwk/AbstractJWKParser.java similarity index 94% rename from authz-client/src/main/java/org/keycloak/jose/jwk/AbstractJWKParser.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwk/AbstractJWKParser.java index b45e3a0..1e08962 100644 --- a/authz-client/src/main/java/org/keycloak/jose/jwk/AbstractJWKParser.java +++ b/client-common-synced/src/main/java/org/keycloak/jose/jwk/AbstractJWKParser.java @@ -41,10 +41,13 @@ public JWK getJwk() { } public PublicKey toPublicKey() { + if (jwk == null) { + throw new IllegalStateException("Not possible to convert to the publicKey. The jwk is not set"); + } String keyType = jwk.getKeyType(); - if (keyType.equals(KeyType.RSA)) { + if (KeyType.RSA.equals(keyType)) { return createRSAPublicKey(); - } else if (keyType.equals(KeyType.EC)) { + } else if (KeyType.EC.equals(keyType)) { return createECPublicKey(); } else { @@ -87,7 +90,7 @@ protected PublicKey createECPublicKey() { } try { - + ECPoint point = new ECPoint(x, y); ECParameterSpec params = CryptoIntegration.getProvider().createECParams(name); ECPublicKeySpec pubKeySpec = new ECPublicKeySpec(point, params); diff --git a/authz-client/src/main/java/org/keycloak/jose/jwk/ECPublicJWK.java b/client-common-synced/src/main/java/org/keycloak/jose/jwk/ECPublicJWK.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwk/ECPublicJWK.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwk/ECPublicJWK.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwk/JSONWebKeySet.java b/client-common-synced/src/main/java/org/keycloak/jose/jwk/JSONWebKeySet.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwk/JSONWebKeySet.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwk/JSONWebKeySet.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwk/JWK.java b/client-common-synced/src/main/java/org/keycloak/jose/jwk/JWK.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwk/JWK.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwk/JWK.java diff --git a/client-common-synced/src/main/java/org/keycloak/jose/jwk/JWKBuilder.java b/client-common-synced/src/main/java/org/keycloak/jose/jwk/JWKBuilder.java new file mode 100644 index 0000000..c3943c7 --- /dev/null +++ b/client-common-synced/src/main/java/org/keycloak/jose/jwk/JWKBuilder.java @@ -0,0 +1,108 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.jose.jwk; + +import java.math.BigInteger; +import java.security.Key; +import java.security.interfaces.EdECPublicKey; +import java.security.spec.EdECPoint; +import java.util.Arrays; +import java.util.Optional; + +import org.keycloak.common.util.Base64Url; +import org.keycloak.common.util.KeyUtils; +import org.keycloak.crypto.Algorithm; +import org.keycloak.crypto.KeyType; +import org.keycloak.crypto.KeyUse; + +/** + * @author Stian Thorgersen + */ +public class JWKBuilder extends AbstractJWKBuilder { + + private JWKBuilder() { + } + + public static JWKBuilder create() { + return new JWKBuilder(); + } + + public JWKBuilder kid(String kid) { + this.kid = kid; + return this; + } + + public JWKBuilder algorithm(String algorithm) { + this.algorithm = algorithm; + return this; + } + + @Override + public JWK okp(Key key) { + return okp(key, DEFAULT_PUBLIC_KEY_USE); + } + + @Override + public JWK okp(Key key, KeyUse keyUse) { + EdECPublicKey eddsaPublicKey = (EdECPublicKey) key; + + OKPPublicJWK k = new OKPPublicJWK(); + + String kid = this.kid != null ? this.kid : KeyUtils.createKeyId(key); + + k.setKeyId(kid); + k.setKeyType(KeyType.OKP); + k.setAlgorithm(algorithm); + k.setPublicKeyUse(keyUse == null ? DEFAULT_PUBLIC_KEY_USE.getSpecName() : keyUse.getSpecName()); + k.setCrv(eddsaPublicKey.getParams().getName()); + + Optional x = edPublicKeyInJwkRepresentation(eddsaPublicKey); + k.setX(x.orElse("")); + + return k; + } + + private Optional edPublicKeyInJwkRepresentation(EdECPublicKey eddsaPublicKey) { + EdECPoint edEcPoint = eddsaPublicKey.getPoint(); + BigInteger yCoordinate = edEcPoint.getY(); + + // JWK representation "x" of a public key + int bytesLength = 0; + if (Algorithm.Ed25519.equals(eddsaPublicKey.getParams().getName())) { + bytesLength = 32; + } else if (Algorithm.Ed448.equals(eddsaPublicKey.getParams().getName())) { + bytesLength = 57; + } else { + return Optional.ofNullable(null); + } + + // consider the case where yCoordinate.toByteArray() is less than bytesLength due to relatively small value of y-coordinate. + byte[] yCoordinateLittleEndianBytes = new byte[bytesLength]; + + // convert big endian representation of BigInteger to little endian representation of JWK representation (RFC 8032,8027) + yCoordinateLittleEndianBytes = Arrays.copyOf(reverseBytes(yCoordinate.toByteArray()), bytesLength); + + // set a parity of x-coordinate to the most significant bit of the last octet (RFC 8032, 8037) + if (edEcPoint.isXOdd()) { + yCoordinateLittleEndianBytes[yCoordinateLittleEndianBytes.length - 1] |= -128; // 0b10000000 + } + + return Optional.ofNullable(Base64Url.encode(yCoordinateLittleEndianBytes)); + } + +} diff --git a/client-common-synced/src/main/java/org/keycloak/jose/jwk/JWKParser.java b/client-common-synced/src/main/java/org/keycloak/jose/jwk/JWKParser.java new file mode 100755 index 0000000..cfa646c --- /dev/null +++ b/client-common-synced/src/main/java/org/keycloak/jose/jwk/JWKParser.java @@ -0,0 +1,127 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.jose.jwk; + +import java.math.BigInteger; +import java.security.KeyFactory; +import java.security.NoSuchAlgorithmException; +import java.security.PublicKey; +import java.security.spec.EdECPoint; +import java.security.spec.EdECPublicKeySpec; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.NamedParameterSpec; + +import org.keycloak.common.util.Base64Url; +import org.keycloak.crypto.Algorithm; +import org.keycloak.crypto.KeyType; +import org.keycloak.util.JsonSerialization; + +/** + * @author Stian Thorgersen + */ +public class JWKParser extends AbstractJWKParser { + + private JWKParser() { + } + + public static JWKParser create() { + return new JWKParser(); + } + + public JWKParser(JWK jwk) { + this.jwk = jwk; + } + + public static JWKParser create(JWK jwk) { + return new JWKParser(jwk); + } + + public JWKParser parse(String jwk) { + try { + this.jwk = JsonSerialization.mapper.readValue(jwk, JWK.class); + return this; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Override + public PublicKey toPublicKey() { + if (jwk == null) { + throw new IllegalStateException("Not possible to convert to the publicKey. The jwk is not set"); + } + String keyType = jwk.getKeyType(); + if (KeyType.RSA.equals(keyType)) { + return createRSAPublicKey(); + } else if (KeyType.EC.equals(keyType)) { + return createECPublicKey(); + } else if (KeyType.OKP.equals(keyType)) { + return createOKPPublicKey(); + } else { + throw new RuntimeException("Unsupported keyType " + keyType); + } + } + + private PublicKey createOKPPublicKey() { + String x = (String) jwk.getOtherClaims().get(OKPPublicJWK.X); + String crv = (String) jwk.getOtherClaims().get(OKPPublicJWK.CRV); + // JWK representation "x" of a public key + int bytesLength = 0; + if (Algorithm.Ed25519.equals(crv)) { + bytesLength = 32; + } else if (Algorithm.Ed448.equals(crv)) { + bytesLength = 57; + } else { + throw new RuntimeException("Invalid JWK representation of OKP type algorithm"); + } + + byte[] decodedX = Base64Url.decode(x); + if (decodedX.length != bytesLength) { + throw new RuntimeException("Invalid JWK representation of OKP type public key"); + } + + // x-coordinate's parity check shown by MSB(bit) of MSB(byte) of decoded "x": 1 is odd, 0 is even + boolean isOddX = false; + if ((decodedX[decodedX.length - 1] & -128) != 0) { // 0b10000000 + isOddX = true; + } + + // MSB(bit) of MSB(byte) showing x-coodinate's parity is set to 0 + decodedX[decodedX.length - 1] &= 127; // 0b01111111 + + // both x and y-coordinate in twisted Edwards curve are always 0 or natural number + BigInteger y = new BigInteger(1, JWKBuilder.reverseBytes(decodedX)); + NamedParameterSpec spec = new NamedParameterSpec(crv); + EdECPoint ep = new EdECPoint(isOddX, y); + EdECPublicKeySpec keySpec = new EdECPublicKeySpec(spec, ep); + + PublicKey publicKey = null; + try { + publicKey = KeyFactory.getInstance(crv).generatePublic(keySpec); + } catch (InvalidKeySpecException | NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + return publicKey; + } + + @Override + public boolean isKeyTypeSupported(String keyType) { + return (RSAPublicJWK.RSA.equals(keyType) || ECPublicJWK.EC.equals(keyType) || OKPPublicJWK.OKP.equals(keyType)); + } + +} diff --git a/authz-client/src/main/java/org/keycloak/jose/jwk/JWKUtil.java b/client-common-synced/src/main/java/org/keycloak/jose/jwk/JWKUtil.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwk/JWKUtil.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwk/JWKUtil.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwk/OKPPublicJWK.java b/client-common-synced/src/main/java/org/keycloak/jose/jwk/OKPPublicJWK.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwk/OKPPublicJWK.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwk/OKPPublicJWK.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jwk/RSAPublicJWK.java b/client-common-synced/src/main/java/org/keycloak/jose/jwk/RSAPublicJWK.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jwk/RSAPublicJWK.java rename to client-common-synced/src/main/java/org/keycloak/jose/jwk/RSAPublicJWK.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jws/Algorithm.java b/client-common-synced/src/main/java/org/keycloak/jose/jws/Algorithm.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jws/Algorithm.java rename to client-common-synced/src/main/java/org/keycloak/jose/jws/Algorithm.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jws/AlgorithmType.java b/client-common-synced/src/main/java/org/keycloak/jose/jws/AlgorithmType.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jws/AlgorithmType.java rename to client-common-synced/src/main/java/org/keycloak/jose/jws/AlgorithmType.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jws/JWSBuilder.java b/client-common-synced/src/main/java/org/keycloak/jose/jws/JWSBuilder.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jws/JWSBuilder.java rename to client-common-synced/src/main/java/org/keycloak/jose/jws/JWSBuilder.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jws/JWSHeader.java b/client-common-synced/src/main/java/org/keycloak/jose/jws/JWSHeader.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jws/JWSHeader.java rename to client-common-synced/src/main/java/org/keycloak/jose/jws/JWSHeader.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jws/JWSInput.java b/client-common-synced/src/main/java/org/keycloak/jose/jws/JWSInput.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jws/JWSInput.java rename to client-common-synced/src/main/java/org/keycloak/jose/jws/JWSInput.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jws/JWSInputException.java b/client-common-synced/src/main/java/org/keycloak/jose/jws/JWSInputException.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jws/JWSInputException.java rename to client-common-synced/src/main/java/org/keycloak/jose/jws/JWSInputException.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jws/crypto/HMACProvider.java b/client-common-synced/src/main/java/org/keycloak/jose/jws/crypto/HMACProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jws/crypto/HMACProvider.java rename to client-common-synced/src/main/java/org/keycloak/jose/jws/crypto/HMACProvider.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jws/crypto/HashUtils.java b/client-common-synced/src/main/java/org/keycloak/jose/jws/crypto/HashUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jws/crypto/HashUtils.java rename to client-common-synced/src/main/java/org/keycloak/jose/jws/crypto/HashUtils.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jws/crypto/RSAProvider.java b/client-common-synced/src/main/java/org/keycloak/jose/jws/crypto/RSAProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jws/crypto/RSAProvider.java rename to client-common-synced/src/main/java/org/keycloak/jose/jws/crypto/RSAProvider.java diff --git a/authz-client/src/main/java/org/keycloak/jose/jws/crypto/SignatureProvider.java b/client-common-synced/src/main/java/org/keycloak/jose/jws/crypto/SignatureProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/jose/jws/crypto/SignatureProvider.java rename to client-common-synced/src/main/java/org/keycloak/jose/jws/crypto/SignatureProvider.java diff --git a/admin-client/src/main/java/org/keycloak/json/StringListMapDeserializer.java b/client-common-synced/src/main/java/org/keycloak/json/StringListMapDeserializer.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/json/StringListMapDeserializer.java rename to client-common-synced/src/main/java/org/keycloak/json/StringListMapDeserializer.java diff --git a/admin-client/src/main/java/org/keycloak/json/StringOrArrayDeserializer.java b/client-common-synced/src/main/java/org/keycloak/json/StringOrArrayDeserializer.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/json/StringOrArrayDeserializer.java rename to client-common-synced/src/main/java/org/keycloak/json/StringOrArrayDeserializer.java diff --git a/admin-client/src/main/java/org/keycloak/json/StringOrArraySerializer.java b/client-common-synced/src/main/java/org/keycloak/json/StringOrArraySerializer.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/json/StringOrArraySerializer.java rename to client-common-synced/src/main/java/org/keycloak/json/StringOrArraySerializer.java diff --git a/authz-client/src/main/java/org/keycloak/protocol/oidc/client/authentication/ClientCredentialsProvider.java b/client-common-synced/src/main/java/org/keycloak/protocol/oidc/client/authentication/ClientCredentialsProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/protocol/oidc/client/authentication/ClientCredentialsProvider.java rename to client-common-synced/src/main/java/org/keycloak/protocol/oidc/client/authentication/ClientCredentialsProvider.java diff --git a/authz-client/src/main/java/org/keycloak/protocol/oidc/client/authentication/ClientCredentialsProviderUtils.java b/client-common-synced/src/main/java/org/keycloak/protocol/oidc/client/authentication/ClientCredentialsProviderUtils.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/protocol/oidc/client/authentication/ClientCredentialsProviderUtils.java rename to client-common-synced/src/main/java/org/keycloak/protocol/oidc/client/authentication/ClientCredentialsProviderUtils.java diff --git a/authz-client/src/main/java/org/keycloak/protocol/oidc/client/authentication/ClientIdAndSecretCredentialsProvider.java b/client-common-synced/src/main/java/org/keycloak/protocol/oidc/client/authentication/ClientIdAndSecretCredentialsProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/protocol/oidc/client/authentication/ClientIdAndSecretCredentialsProvider.java rename to client-common-synced/src/main/java/org/keycloak/protocol/oidc/client/authentication/ClientIdAndSecretCredentialsProvider.java diff --git a/authz-client/src/main/java/org/keycloak/protocol/oidc/client/authentication/JWTClientCredentialsProvider.java b/client-common-synced/src/main/java/org/keycloak/protocol/oidc/client/authentication/JWTClientCredentialsProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/protocol/oidc/client/authentication/JWTClientCredentialsProvider.java rename to client-common-synced/src/main/java/org/keycloak/protocol/oidc/client/authentication/JWTClientCredentialsProvider.java diff --git a/authz-client/src/main/java/org/keycloak/protocol/oidc/client/authentication/JWTClientSecretCredentialsProvider.java b/client-common-synced/src/main/java/org/keycloak/protocol/oidc/client/authentication/JWTClientSecretCredentialsProvider.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/protocol/oidc/client/authentication/JWTClientSecretCredentialsProvider.java rename to client-common-synced/src/main/java/org/keycloak/protocol/oidc/client/authentication/JWTClientSecretCredentialsProvider.java diff --git a/admin-client/src/main/java/org/keycloak/representations/AccessToken.java b/client-common-synced/src/main/java/org/keycloak/representations/AccessToken.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/AccessToken.java rename to client-common-synced/src/main/java/org/keycloak/representations/AccessToken.java diff --git a/admin-client/src/main/java/org/keycloak/representations/AccessTokenResponse.java b/client-common-synced/src/main/java/org/keycloak/representations/AccessTokenResponse.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/AccessTokenResponse.java rename to client-common-synced/src/main/java/org/keycloak/representations/AccessTokenResponse.java diff --git a/admin-client/src/main/java/org/keycloak/representations/AddressClaimSet.java b/client-common-synced/src/main/java/org/keycloak/representations/AddressClaimSet.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/AddressClaimSet.java rename to client-common-synced/src/main/java/org/keycloak/representations/AddressClaimSet.java diff --git a/admin-client/src/main/java/org/keycloak/representations/IDToken.java b/client-common-synced/src/main/java/org/keycloak/representations/IDToken.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/IDToken.java rename to client-common-synced/src/main/java/org/keycloak/representations/IDToken.java diff --git a/admin-client/src/main/java/org/keycloak/representations/JsonWebToken.java b/client-common-synced/src/main/java/org/keycloak/representations/JsonWebToken.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/JsonWebToken.java rename to client-common-synced/src/main/java/org/keycloak/representations/JsonWebToken.java diff --git a/admin-client/src/main/java/org/keycloak/representations/KeyStoreConfig.java b/client-common-synced/src/main/java/org/keycloak/representations/KeyStoreConfig.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/KeyStoreConfig.java rename to client-common-synced/src/main/java/org/keycloak/representations/KeyStoreConfig.java diff --git a/authz-client/src/main/java/org/keycloak/representations/RefreshToken.java b/client-common-synced/src/main/java/org/keycloak/representations/RefreshToken.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/representations/RefreshToken.java rename to client-common-synced/src/main/java/org/keycloak/representations/RefreshToken.java diff --git a/admin-client/src/main/java/org/keycloak/representations/adapters/action/GlobalRequestResult.java b/client-common-synced/src/main/java/org/keycloak/representations/adapters/action/GlobalRequestResult.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/adapters/action/GlobalRequestResult.java rename to client-common-synced/src/main/java/org/keycloak/representations/adapters/action/GlobalRequestResult.java diff --git a/authz-client/src/main/java/org/keycloak/representations/adapters/config/AdapterConfig.java b/client-common-synced/src/main/java/org/keycloak/representations/adapters/config/AdapterConfig.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/representations/adapters/config/AdapterConfig.java rename to client-common-synced/src/main/java/org/keycloak/representations/adapters/config/AdapterConfig.java diff --git a/authz-client/src/main/java/org/keycloak/representations/adapters/config/AdapterHttpClientConfig.java b/client-common-synced/src/main/java/org/keycloak/representations/adapters/config/AdapterHttpClientConfig.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/representations/adapters/config/AdapterHttpClientConfig.java rename to client-common-synced/src/main/java/org/keycloak/representations/adapters/config/AdapterHttpClientConfig.java diff --git a/authz-client/src/main/java/org/keycloak/representations/adapters/config/BaseAdapterConfig.java b/client-common-synced/src/main/java/org/keycloak/representations/adapters/config/BaseAdapterConfig.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/representations/adapters/config/BaseAdapterConfig.java rename to client-common-synced/src/main/java/org/keycloak/representations/adapters/config/BaseAdapterConfig.java diff --git a/authz-client/src/main/java/org/keycloak/representations/adapters/config/BaseRealmConfig.java b/client-common-synced/src/main/java/org/keycloak/representations/adapters/config/BaseRealmConfig.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/representations/adapters/config/BaseRealmConfig.java rename to client-common-synced/src/main/java/org/keycloak/representations/adapters/config/BaseRealmConfig.java diff --git a/authz-client/src/main/java/org/keycloak/representations/adapters/config/PolicyEnforcerConfig.java b/client-common-synced/src/main/java/org/keycloak/representations/adapters/config/PolicyEnforcerConfig.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/representations/adapters/config/PolicyEnforcerConfig.java rename to client-common-synced/src/main/java/org/keycloak/representations/adapters/config/PolicyEnforcerConfig.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/AbstractAuthenticationExecutionRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/AbstractAuthenticationExecutionRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/AbstractAuthenticationExecutionRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/AbstractAuthenticationExecutionRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/AbstractUserRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/AbstractUserRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/AbstractUserRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/AbstractUserRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/AdminEventRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/AdminEventRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/AdminEventRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/AdminEventRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ApplicationRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ApplicationRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ApplicationRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ApplicationRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/AuthDetailsRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/AuthDetailsRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/AuthDetailsRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/AuthDetailsRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionExportRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionExportRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionExportRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionExportRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionInfoRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionInfoRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionInfoRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionInfoRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/AuthenticationExecutionRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/AuthenticationFlowRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/AuthenticationFlowRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/AuthenticationFlowRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/AuthenticationFlowRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/AuthenticatorConfigInfoRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/AuthenticatorConfigInfoRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/AuthenticatorConfigInfoRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/AuthenticatorConfigInfoRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/AuthenticatorConfigRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/AuthenticatorConfigRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/AuthenticatorConfigRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/AuthenticatorConfigRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/CertificateRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/CertificateRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/CertificateRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/CertificateRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClaimRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClaimRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClaimRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClaimRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientInitialAccessCreatePresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientInitialAccessCreatePresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientInitialAccessCreatePresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientInitialAccessCreatePresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientInitialAccessPresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientInitialAccessPresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientInitialAccessPresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientInitialAccessPresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientMappingsRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientMappingsRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientMappingsRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientMappingsRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientPoliciesRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientPoliciesRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientPoliciesRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientPoliciesRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionConfigurationRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionConfigurationRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionConfigurationRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionConfigurationRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientPolicyConditionRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorConfigurationRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorConfigurationRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorConfigurationRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorConfigurationRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientPolicyExecutorRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientPolicyRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientPolicyRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientPolicyRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientPolicyRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientProfileRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientProfileRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientProfileRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientProfileRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientProfilesRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientProfilesRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientProfilesRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientProfilesRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientScopeRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientScopeRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientScopeRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientScopeRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientTemplateRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientTemplateRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientTemplateRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientTemplateRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientTypeRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientTypeRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientTypeRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientTypeRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ClientTypesRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ClientTypesRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ClientTypesRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ClientTypesRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ComponentExportRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ComponentExportRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ComponentExportRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ComponentExportRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ComponentRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ComponentRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ComponentRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ComponentRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ComponentTypeRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ComponentTypeRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ComponentTypeRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ComponentTypeRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ConfigPropertyRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ConfigPropertyRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ConfigPropertyRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ConfigPropertyRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/CredentialRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/CredentialRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/CredentialRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/CredentialRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ErrorRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ErrorRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ErrorRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ErrorRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/EventRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/EventRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/EventRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/EventRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/FederatedIdentityRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/FederatedIdentityRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/FederatedIdentityRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/FederatedIdentityRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/GroupRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/GroupRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/GroupRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/GroupRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/IdentityProviderMapperRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/IdentityProviderMapperRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/IdentityProviderMapperRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/IdentityProviderMapperRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/IdentityProviderMapperTypeRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/IdentityProviderMapperTypeRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/IdentityProviderMapperTypeRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/IdentityProviderMapperTypeRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/IdentityProviderRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/IdentityProviderRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/IdentityProviderRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/IdentityProviderRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/KeysMetadataRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/KeysMetadataRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/KeysMetadataRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/KeysMetadataRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/LDAPCapabilityRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/LDAPCapabilityRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/LDAPCapabilityRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/LDAPCapabilityRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ManagementPermissionReference.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ManagementPermissionReference.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ManagementPermissionReference.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ManagementPermissionReference.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ManagementPermissionRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ManagementPermissionRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ManagementPermissionRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ManagementPermissionRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/MappingsRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/MappingsRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/MappingsRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/MappingsRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/MemberRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/MemberRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/MemberRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/MemberRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/MembershipType.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/MembershipType.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/MembershipType.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/MembershipType.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/OAuth2ErrorRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/OAuth2ErrorRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/OAuth2ErrorRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/OAuth2ErrorRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/OAuthClientRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/OAuthClientRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/OAuthClientRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/OAuthClientRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/OrganizationDomainRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/OrganizationDomainRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/OrganizationDomainRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/OrganizationDomainRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/OrganizationRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/OrganizationRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/OrganizationRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/OrganizationRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/PartialImportRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/PartialImportRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/PartialImportRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/PartialImportRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/PasswordPolicyTypeRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/PasswordPolicyTypeRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/PasswordPolicyTypeRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/PasswordPolicyTypeRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ProtocolMapperRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ProtocolMapperRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ProtocolMapperRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ProtocolMapperRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ProtocolMapperTypeRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ProtocolMapperTypeRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ProtocolMapperTypeRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ProtocolMapperTypeRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/PublishedRealmRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/PublishedRealmRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/PublishedRealmRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/PublishedRealmRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/RealmEventsConfigRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/RealmEventsConfigRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/RealmEventsConfigRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/RealmEventsConfigRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/RequiredActionConfigInfoRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/RequiredActionConfigInfoRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/RequiredActionConfigInfoRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/RequiredActionConfigInfoRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/RequiredActionConfigRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/RequiredActionConfigRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/RequiredActionConfigRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/RequiredActionConfigRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/RequiredActionProviderRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/RequiredActionProviderRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/RequiredActionProviderRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/RequiredActionProviderRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/RequiredActionProviderSimpleRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/RequiredActionProviderSimpleRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/RequiredActionProviderSimpleRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/RequiredActionProviderSimpleRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/RoleRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/RoleRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/RoleRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/RoleRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/RolesRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/RolesRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/RolesRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/RolesRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/ScopeMappingRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/ScopeMappingRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/ScopeMappingRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/ScopeMappingRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/SecurityProfileConfiguration.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/SecurityProfileConfiguration.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/SecurityProfileConfiguration.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/SecurityProfileConfiguration.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/SocialLinkRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/SocialLinkRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/SocialLinkRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/SocialLinkRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/SynchronizationResultRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/SynchronizationResultRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/SynchronizationResultRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/SynchronizationResultRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/TestLdapConnectionRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/TestLdapConnectionRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/TestLdapConnectionRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/TestLdapConnectionRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/UserConsentRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/UserConsentRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/UserConsentRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/UserConsentRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/UserFederationMapperRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/UserFederationMapperRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperSyncConfigRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/UserFederationMapperSyncConfigRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperSyncConfigRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/UserFederationMapperSyncConfigRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperTypeRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/UserFederationMapperTypeRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/UserFederationMapperTypeRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/UserFederationMapperTypeRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/UserFederationProviderFactoryRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/UserFederationProviderFactoryRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/UserFederationProviderFactoryRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/UserFederationProviderFactoryRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/UserFederationProviderRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/UserFederationProviderRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/UserFederationProviderRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/UserFederationProviderRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/UserProfileAttributeGroupMetadata.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/UserProfileAttributeGroupMetadata.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/UserProfileAttributeGroupMetadata.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/UserProfileAttributeGroupMetadata.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/UserProfileAttributeMetadata.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/UserProfileAttributeMetadata.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/UserProfileAttributeMetadata.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/UserProfileAttributeMetadata.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/UserProfileMetadata.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/UserProfileMetadata.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/UserProfileMetadata.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/UserProfileMetadata.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/UserRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/UserRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/UserRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/UserRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/UserSessionRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/UserSessionRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/UserSessionRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/UserSessionRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/AbstractPolicyRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/AbstractPolicyRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/AbstractPolicyRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/AbstractPolicyRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/AggregatePolicyRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/AggregatePolicyRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/AggregatePolicyRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/AggregatePolicyRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/AuthorizationRequest.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/AuthorizationRequest.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/AuthorizationRequest.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/AuthorizationRequest.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/AuthorizationResponse.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/AuthorizationResponse.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/AuthorizationResponse.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/AuthorizationResponse.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/ClientPolicyRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ClientPolicyRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/ClientPolicyRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ClientPolicyRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/ClientScopePolicyRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ClientScopePolicyRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/ClientScopePolicyRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ClientScopePolicyRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/DecisionEffect.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/DecisionEffect.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/DecisionEffect.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/DecisionEffect.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/DecisionStrategy.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/DecisionStrategy.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/DecisionStrategy.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/DecisionStrategy.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/GroupPolicyRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/GroupPolicyRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/GroupPolicyRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/GroupPolicyRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/JSPolicyRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/JSPolicyRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/JSPolicyRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/JSPolicyRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/Logic.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/Logic.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/Logic.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/Logic.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/Permission.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/Permission.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/Permission.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/Permission.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionRequest.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PermissionRequest.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionRequest.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PermissionRequest.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionResponse.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PermissionResponse.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionResponse.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PermissionResponse.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionTicketRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PermissionTicketRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionTicketRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PermissionTicketRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionTicketToken.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PermissionTicketToken.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/PermissionTicketToken.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PermissionTicketToken.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEnforcementMode.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PolicyEnforcementMode.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEnforcementMode.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PolicyEnforcementMode.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEvaluationRequest.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PolicyEvaluationRequest.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEvaluationRequest.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PolicyEvaluationRequest.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEvaluationResponse.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PolicyEvaluationResponse.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyEvaluationResponse.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PolicyEvaluationResponse.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyProviderRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PolicyProviderRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyProviderRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PolicyProviderRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PolicyRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/PolicyRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/PolicyRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/RegexPolicyRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/RegexPolicyRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/RegexPolicyRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/RegexPolicyRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceOwnerRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ResourceOwnerRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceOwnerRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ResourceOwnerRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/ResourcePermissionRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ResourcePermissionRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/ResourcePermissionRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ResourcePermissionRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ResourceRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ResourceRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceServerRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ResourceServerRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/ResourceServerRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ResourceServerRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/RolePolicyRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/RolePolicyRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/RolePolicyRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/RolePolicyRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/ScopePermissionRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ScopePermissionRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/ScopePermissionRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ScopePermissionRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/ScopeRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ScopeRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/ScopeRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/ScopeRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/TimePolicyRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/TimePolicyRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/TimePolicyRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/TimePolicyRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/UmaPermissionRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/UmaPermissionRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/UmaPermissionRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/UmaPermissionRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/idm/authorization/UserPolicyRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/UserPolicyRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/idm/authorization/UserPolicyRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/idm/authorization/UserPolicyRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/info/ClientInstallationRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/info/ClientInstallationRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/info/ClientInstallationRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/info/ClientInstallationRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/info/CryptoInfoRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/info/CryptoInfoRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/info/CryptoInfoRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/info/CryptoInfoRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/info/FeatureRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/info/FeatureRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/info/FeatureRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/info/FeatureRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/info/FeatureType.java b/client-common-synced/src/main/java/org/keycloak/representations/info/FeatureType.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/info/FeatureType.java rename to client-common-synced/src/main/java/org/keycloak/representations/info/FeatureType.java diff --git a/admin-client/src/main/java/org/keycloak/representations/info/MemoryInfoRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/info/MemoryInfoRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/info/MemoryInfoRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/info/MemoryInfoRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/info/ProfileInfoRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/info/ProfileInfoRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/info/ProfileInfoRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/info/ProfileInfoRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/info/ProviderRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/info/ProviderRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/info/ProviderRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/info/ProviderRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/info/ServerInfoRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/info/ServerInfoRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/info/ServerInfoRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/info/ServerInfoRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/info/SpiInfoRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/info/SpiInfoRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/info/SpiInfoRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/info/SpiInfoRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/info/SystemInfoRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/info/SystemInfoRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/info/SystemInfoRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/info/SystemInfoRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/info/ThemeInfoRepresentation.java b/client-common-synced/src/main/java/org/keycloak/representations/info/ThemeInfoRepresentation.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/info/ThemeInfoRepresentation.java rename to client-common-synced/src/main/java/org/keycloak/representations/info/ThemeInfoRepresentation.java diff --git a/admin-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttribute.java b/client-common-synced/src/main/java/org/keycloak/representations/userprofile/config/UPAttribute.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttribute.java rename to client-common-synced/src/main/java/org/keycloak/representations/userprofile/config/UPAttribute.java diff --git a/admin-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributePermissions.java b/client-common-synced/src/main/java/org/keycloak/representations/userprofile/config/UPAttributePermissions.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributePermissions.java rename to client-common-synced/src/main/java/org/keycloak/representations/userprofile/config/UPAttributePermissions.java diff --git a/admin-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributeRequired.java b/client-common-synced/src/main/java/org/keycloak/representations/userprofile/config/UPAttributeRequired.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributeRequired.java rename to client-common-synced/src/main/java/org/keycloak/representations/userprofile/config/UPAttributeRequired.java diff --git a/admin-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributeSelector.java b/client-common-synced/src/main/java/org/keycloak/representations/userprofile/config/UPAttributeSelector.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/userprofile/config/UPAttributeSelector.java rename to client-common-synced/src/main/java/org/keycloak/representations/userprofile/config/UPAttributeSelector.java diff --git a/admin-client/src/main/java/org/keycloak/representations/userprofile/config/UPConfig.java b/client-common-synced/src/main/java/org/keycloak/representations/userprofile/config/UPConfig.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/userprofile/config/UPConfig.java rename to client-common-synced/src/main/java/org/keycloak/representations/userprofile/config/UPConfig.java diff --git a/admin-client/src/main/java/org/keycloak/representations/userprofile/config/UPGroup.java b/client-common-synced/src/main/java/org/keycloak/representations/userprofile/config/UPGroup.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/representations/userprofile/config/UPGroup.java rename to client-common-synced/src/main/java/org/keycloak/representations/userprofile/config/UPGroup.java diff --git a/admin-client/src/main/java/org/keycloak/util/BasicAuthHelper.java b/client-common-synced/src/main/java/org/keycloak/util/BasicAuthHelper.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/util/BasicAuthHelper.java rename to client-common-synced/src/main/java/org/keycloak/util/BasicAuthHelper.java diff --git a/admin-client/src/main/java/org/keycloak/util/EnumWithStableIndex.java b/client-common-synced/src/main/java/org/keycloak/util/EnumWithStableIndex.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/util/EnumWithStableIndex.java rename to client-common-synced/src/main/java/org/keycloak/util/EnumWithStableIndex.java diff --git a/admin-client/src/main/java/org/keycloak/util/JsonSerialization.java b/client-common-synced/src/main/java/org/keycloak/util/JsonSerialization.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/util/JsonSerialization.java rename to client-common-synced/src/main/java/org/keycloak/util/JsonSerialization.java diff --git a/admin-client/src/main/java/org/keycloak/util/SystemPropertiesJsonParserFactory.java b/client-common-synced/src/main/java/org/keycloak/util/SystemPropertiesJsonParserFactory.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/util/SystemPropertiesJsonParserFactory.java rename to client-common-synced/src/main/java/org/keycloak/util/SystemPropertiesJsonParserFactory.java diff --git a/authz-client/src/main/java/org/keycloak/util/TokenUtil.java b/client-common-synced/src/main/java/org/keycloak/util/TokenUtil.java similarity index 100% rename from authz-client/src/main/java/org/keycloak/util/TokenUtil.java rename to client-common-synced/src/main/java/org/keycloak/util/TokenUtil.java diff --git a/admin-client/src/main/java/org/keycloak/utils/StringUtil.java b/client-common-synced/src/main/java/org/keycloak/utils/StringUtil.java similarity index 100% rename from admin-client/src/main/java/org/keycloak/utils/StringUtil.java rename to client-common-synced/src/main/java/org/keycloak/utils/StringUtil.java diff --git a/authz-client/src/main/resources/META-INF/services/org.keycloak.protocol.oidc.client.authentication.ClientCredentialsProvider b/client-common-synced/src/main/resources/META-INF/services/org.keycloak.protocol.oidc.client.authentication.ClientCredentialsProvider similarity index 100% rename from authz-client/src/main/resources/META-INF/services/org.keycloak.protocol.oidc.client.authentication.ClientCredentialsProvider rename to client-common-synced/src/main/resources/META-INF/services/org.keycloak.protocol.oidc.client.authentication.ClientCredentialsProvider diff --git a/policy-enforcer/pom.xml b/policy-enforcer/pom.xml index ededa85..4e5a28e 100755 --- a/policy-enforcer/pom.xml +++ b/policy-enforcer/pom.xml @@ -35,6 +35,10 @@ org.keycloak keycloak-authz-client + + org.keycloak + keycloak-client-common-synced + diff --git a/pom.xml b/pom.xml index 6f494ea..e0c9e4d 100644 --- a/pom.xml +++ b/pom.xml @@ -126,6 +126,7 @@ + client-common-synced admin-client authz-client policy-enforcer @@ -135,6 +136,11 @@ + + org.keycloak + keycloak-client-common-synced + ${project.version} + org.jboss.logging jboss-logging