@keycloak/keycloak-admin-client 21.0.2 → 21.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -62
- package/lib/client.d.ts +22 -25
- package/lib/client.js +53 -33
- package/lib/defs/AccessTokenAccess.js +0 -1
- package/lib/defs/PermissonRepresentation.js +0 -1
- package/lib/defs/accessTokenCertConf.d.ts +1 -1
- package/lib/defs/accessTokenCertConf.js +0 -1
- package/lib/defs/accessTokenRepresentation.d.ts +6 -6
- package/lib/defs/accessTokenRepresentation.js +0 -1
- package/lib/defs/addressClaimSet.js +0 -1
- package/lib/defs/adminEventRepresentation.d.ts +1 -1
- package/lib/defs/adminEventRepresentation.js +0 -1
- package/lib/defs/authDetailsRepresentation.js +0 -1
- package/lib/defs/authenticationExecutionExportRepresentation.d.ts +3 -0
- package/lib/defs/authenticationExecutionExportRepresentation.js +0 -1
- package/lib/defs/authenticationExecutionInfoRepresentation.d.ts +3 -0
- package/lib/defs/authenticationExecutionInfoRepresentation.js +0 -1
- package/lib/defs/authenticationFlowRepresentation.d.ts +4 -1
- package/lib/defs/authenticationFlowRepresentation.js +0 -1
- package/lib/defs/authenticatorConfigInfoRepresentation.d.ts +3 -0
- package/lib/defs/authenticatorConfigInfoRepresentation.js +0 -1
- package/lib/defs/authenticatorConfigRepresentation.d.ts +3 -0
- package/lib/defs/authenticatorConfigRepresentation.js +0 -1
- package/lib/defs/certificateRepresentation.d.ts +3 -0
- package/lib/defs/certificateRepresentation.js +0 -1
- package/lib/defs/clientInitialAccessPresentation.d.ts +3 -0
- package/lib/defs/clientInitialAccessPresentation.js +0 -1
- package/lib/defs/clientPoliciesRepresentation.d.ts +4 -1
- package/lib/defs/clientPoliciesRepresentation.js +0 -1
- package/lib/defs/clientPolicyConditionRepresentation.d.ts +3 -0
- package/lib/defs/clientPolicyConditionRepresentation.js +0 -1
- package/lib/defs/clientPolicyExecutorRepresentation.d.ts +3 -0
- package/lib/defs/clientPolicyExecutorRepresentation.js +0 -1
- package/lib/defs/clientPolicyRepresentation.d.ts +4 -1
- package/lib/defs/clientPolicyRepresentation.js +0 -1
- package/lib/defs/clientProfileRepresentation.d.ts +4 -1
- package/lib/defs/clientProfileRepresentation.js +0 -1
- package/lib/defs/clientProfilesRepresentation.d.ts +4 -1
- package/lib/defs/clientProfilesRepresentation.js +0 -1
- package/lib/defs/clientRepresentation.d.ts +5 -2
- package/lib/defs/clientRepresentation.js +0 -1
- package/lib/defs/clientScopeRepresentation.d.ts +4 -1
- package/lib/defs/clientScopeRepresentation.js +0 -1
- package/lib/defs/clientSessionStat.d.ts +6 -0
- package/lib/defs/clientSessionStat.js +1 -0
- package/lib/defs/componentExportRepresentation.d.ts +3 -0
- package/lib/defs/componentExportRepresentation.js +3 -1
- package/lib/defs/componentRepresentation.d.ts +3 -0
- package/lib/defs/componentRepresentation.js +3 -1
- package/lib/defs/componentTypeRepresentation.d.ts +4 -1
- package/lib/defs/componentTypeRepresentation.js +0 -1
- package/lib/defs/configPropertyRepresentation.d.ts +3 -0
- package/lib/defs/configPropertyRepresentation.js +0 -1
- package/lib/defs/credentialRepresentation.d.ts +3 -0
- package/lib/defs/credentialRepresentation.js +3 -1
- package/lib/defs/evaluationResultRepresentation.d.ts +4 -4
- package/lib/defs/evaluationResultRepresentation.js +0 -1
- package/lib/defs/eventRepresentation.d.ts +4 -1
- package/lib/defs/eventRepresentation.js +0 -1
- package/lib/defs/eventTypes.d.ts +1 -1
- package/lib/defs/eventTypes.js +0 -1
- package/lib/defs/federatedIdentityRepresentation.d.ts +3 -0
- package/lib/defs/federatedIdentityRepresentation.js +3 -1
- package/lib/defs/globalRequestResult.d.ts +3 -0
- package/lib/defs/globalRequestResult.js +0 -1
- package/lib/defs/groupRepresentation.d.ts +3 -0
- package/lib/defs/groupRepresentation.js +3 -1
- package/lib/defs/identityProviderMapperRepresentation.d.ts +3 -0
- package/lib/defs/identityProviderMapperRepresentation.js +3 -1
- package/lib/defs/identityProviderMapperTypeRepresentation.d.ts +1 -1
- package/lib/defs/identityProviderMapperTypeRepresentation.js +0 -1
- package/lib/defs/identityProviderRepresentation.d.ts +3 -0
- package/lib/defs/identityProviderRepresentation.js +3 -1
- package/lib/defs/keyMetadataRepresentation.d.ts +3 -0
- package/lib/defs/keyMetadataRepresentation.js +0 -1
- package/lib/defs/keystoreConfig.d.ts +3 -0
- package/lib/defs/keystoreConfig.js +0 -1
- package/lib/defs/managementPermissionReference.js +0 -1
- package/lib/defs/mappingsRepresentation.d.ts +4 -1
- package/lib/defs/mappingsRepresentation.js +0 -1
- package/lib/defs/passwordPolicyTypeRepresentation.d.ts +3 -0
- package/lib/defs/passwordPolicyTypeRepresentation.js +0 -1
- package/lib/defs/policyEvaluationResponse.d.ts +3 -3
- package/lib/defs/policyEvaluationResponse.js +0 -1
- package/lib/defs/policyProviderRepresentation.js +0 -1
- package/lib/defs/policyRepresentation.d.ts +3 -0
- package/lib/defs/policyRepresentation.js +3 -1
- package/lib/defs/policyResultRepresentation.d.ts +2 -2
- package/lib/defs/policyResultRepresentation.js +0 -1
- package/lib/defs/profileInfoRepresentation.d.ts +3 -0
- package/lib/defs/profileInfoRepresentation.js +0 -1
- package/lib/defs/protocolMapperRepresentation.d.ts +3 -0
- package/lib/defs/protocolMapperRepresentation.js +3 -1
- package/lib/defs/realmEventsConfigRepresentation.d.ts +3 -0
- package/lib/defs/realmEventsConfigRepresentation.js +3 -1
- package/lib/defs/realmRepresentation.d.ts +20 -14
- package/lib/defs/realmRepresentation.js +0 -1
- package/lib/defs/requiredActionProviderRepresentation.d.ts +4 -1
- package/lib/defs/requiredActionProviderRepresentation.js +4 -2
- package/lib/defs/requiredActionProviderSimpleRepresentation.js +0 -1
- package/lib/defs/resourceEvaluation.d.ts +1 -1
- package/lib/defs/resourceEvaluation.js +0 -1
- package/lib/defs/resourceRepresentation.d.ts +5 -2
- package/lib/defs/resourceRepresentation.js +0 -1
- package/lib/defs/resourceServerRepresentation.d.ts +10 -7
- package/lib/defs/resourceServerRepresentation.js +0 -1
- package/lib/defs/roleRepresentation.d.ts +3 -0
- package/lib/defs/roleRepresentation.js +3 -1
- package/lib/defs/rolesRepresentation.d.ts +4 -1
- package/lib/defs/rolesRepresentation.js +3 -1
- package/lib/defs/scopeRepresentation.d.ts +5 -2
- package/lib/defs/scopeRepresentation.js +0 -1
- package/lib/defs/serverInfoRepesentation.d.ts +14 -6
- package/lib/defs/serverInfoRepesentation.js +0 -1
- package/lib/defs/synchronizationResultRepresentation.d.ts +3 -0
- package/lib/defs/synchronizationResultRepresentation.js +3 -1
- package/lib/defs/systemInfoRepersantation.d.ts +3 -0
- package/lib/defs/systemInfoRepersantation.js +3 -1
- package/lib/defs/testLdapConnection.d.ts +3 -0
- package/lib/defs/testLdapConnection.js +3 -1
- package/lib/defs/userConsentRepresentation.d.ts +3 -0
- package/lib/defs/userConsentRepresentation.js +3 -1
- package/lib/defs/userProfileConfig.js +0 -1
- package/lib/defs/userRepresentation.d.ts +4 -4
- package/lib/defs/userRepresentation.js +0 -1
- package/lib/defs/userSessionRepresentation.js +0 -1
- package/lib/defs/whoAmIRepresentation.d.ts +1 -1
- package/lib/defs/whoAmIRepresentation.js +0 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +3 -3
- package/lib/resources/agent.d.ts +9 -5
- package/lib/resources/agent.js +80 -41
- package/lib/resources/attackDetection.d.ts +2 -2
- package/lib/resources/attackDetection.js +17 -18
- package/lib/resources/authenticationManagement.d.ts +13 -9
- package/lib/resources/authenticationManagement.js +165 -154
- package/lib/resources/cache.d.ts +2 -2
- package/lib/resources/cache.js +6 -7
- package/lib/resources/clientPolicies.d.ts +7 -4
- package/lib/resources/clientPolicies.js +27 -23
- package/lib/resources/clientScopes.d.ts +30 -6
- package/lib/resources/clientScopes.js +172 -149
- package/lib/resources/clients.d.ts +65 -26
- package/lib/resources/clients.js +557 -506
- package/lib/resources/components.d.ts +8 -4
- package/lib/resources/components.js +35 -32
- package/lib/resources/groups.d.ts +29 -8
- package/lib/resources/groups.js +132 -111
- package/lib/resources/identityProviders.d.ts +10 -6
- package/lib/resources/identityProviders.js +83 -80
- package/lib/resources/realms.d.ts +40 -17
- package/lib/resources/realms.js +227 -204
- package/lib/resources/resource.d.ts +3 -3
- package/lib/resources/resource.js +9 -8
- package/lib/resources/roles.d.ts +17 -5
- package/lib/resources/roles.js +96 -85
- package/lib/resources/serverInfo.d.ts +3 -3
- package/lib/resources/serverInfo.js +6 -7
- package/lib/resources/userStorageProvider.d.ts +6 -6
- package/lib/resources/userStorageProvider.js +29 -30
- package/lib/resources/users.d.ts +78 -18
- package/lib/resources/users.js +281 -227
- package/lib/resources/whoAmI.d.ts +3 -3
- package/lib/resources/whoAmI.js +6 -7
- package/lib/utils/auth.d.ts +5 -3
- package/lib/utils/auth.js +26 -18
- package/lib/utils/constants.d.ts +1 -1
- package/lib/utils/constants.js +2 -3
- package/lib/utils/fetchWithError.d.ts +11 -0
- package/lib/utils/fetchWithError.js +32 -0
- package/lib/utils/stringifyQueryParams.js +3 -5
- package/package.json +44 -36
- package/lib/client.js.map +0 -1
- package/lib/defs/AccessTokenAccess.js.map +0 -1
- package/lib/defs/PermissonRepresentation.js.map +0 -1
- package/lib/defs/accessTokenCertConf.js.map +0 -1
- package/lib/defs/accessTokenRepresentation.js.map +0 -1
- package/lib/defs/addressClaimSet.js.map +0 -1
- package/lib/defs/adminEventRepresentation.js.map +0 -1
- package/lib/defs/authDetailsRepresentation.js.map +0 -1
- package/lib/defs/authenticationExecutionExportRepresentation.js.map +0 -1
- package/lib/defs/authenticationExecutionInfoRepresentation.js.map +0 -1
- package/lib/defs/authenticationFlowRepresentation.js.map +0 -1
- package/lib/defs/authenticatorConfigInfoRepresentation.js.map +0 -1
- package/lib/defs/authenticatorConfigRepresentation.js.map +0 -1
- package/lib/defs/certificateRepresentation.js.map +0 -1
- package/lib/defs/clientInitialAccessPresentation.js.map +0 -1
- package/lib/defs/clientPoliciesRepresentation.js.map +0 -1
- package/lib/defs/clientPolicyConditionRepresentation.js.map +0 -1
- package/lib/defs/clientPolicyExecutorRepresentation.js.map +0 -1
- package/lib/defs/clientPolicyRepresentation.js.map +0 -1
- package/lib/defs/clientProfileRepresentation.js.map +0 -1
- package/lib/defs/clientProfilesRepresentation.js.map +0 -1
- package/lib/defs/clientRepresentation.js.map +0 -1
- package/lib/defs/clientScopeRepresentation.js.map +0 -1
- package/lib/defs/componentExportRepresentation.js.map +0 -1
- package/lib/defs/componentRepresentation.js.map +0 -1
- package/lib/defs/componentTypeRepresentation.js.map +0 -1
- package/lib/defs/configPropertyRepresentation.js.map +0 -1
- package/lib/defs/credentialRepresentation.js.map +0 -1
- package/lib/defs/evaluationResultRepresentation.js.map +0 -1
- package/lib/defs/eventRepresentation.js.map +0 -1
- package/lib/defs/eventTypes.js.map +0 -1
- package/lib/defs/federatedIdentityRepresentation.js.map +0 -1
- package/lib/defs/globalRequestResult.js.map +0 -1
- package/lib/defs/groupRepresentation.js.map +0 -1
- package/lib/defs/identityProviderMapperRepresentation.js.map +0 -1
- package/lib/defs/identityProviderMapperTypeRepresentation.js.map +0 -1
- package/lib/defs/identityProviderRepresentation.js.map +0 -1
- package/lib/defs/keyMetadataRepresentation.js.map +0 -1
- package/lib/defs/keystoreConfig.js.map +0 -1
- package/lib/defs/managementPermissionReference.js.map +0 -1
- package/lib/defs/mappingsRepresentation.js.map +0 -1
- package/lib/defs/passwordPolicyTypeRepresentation.js.map +0 -1
- package/lib/defs/policyEvaluationResponse.js.map +0 -1
- package/lib/defs/policyProviderRepresentation.js.map +0 -1
- package/lib/defs/policyRepresentation.js.map +0 -1
- package/lib/defs/policyResultRepresentation.js.map +0 -1
- package/lib/defs/profileInfoRepresentation.js.map +0 -1
- package/lib/defs/protocolMapperRepresentation.js.map +0 -1
- package/lib/defs/realmEventsConfigRepresentation.js.map +0 -1
- package/lib/defs/realmRepresentation.js.map +0 -1
- package/lib/defs/requiredActionProviderRepresentation.js.map +0 -1
- package/lib/defs/requiredActionProviderSimpleRepresentation.js.map +0 -1
- package/lib/defs/resourceEvaluation.js.map +0 -1
- package/lib/defs/resourceRepresentation.js.map +0 -1
- package/lib/defs/resourceServerRepresentation.js.map +0 -1
- package/lib/defs/roleRepresentation.js.map +0 -1
- package/lib/defs/rolesRepresentation.js.map +0 -1
- package/lib/defs/scopeRepresentation.js.map +0 -1
- package/lib/defs/serverInfoRepesentation.js.map +0 -1
- package/lib/defs/synchronizationResultRepresentation.js.map +0 -1
- package/lib/defs/systemInfoRepersantation.js.map +0 -1
- package/lib/defs/testLdapConnection.js.map +0 -1
- package/lib/defs/userConsentRepresentation.js.map +0 -1
- package/lib/defs/userProfileConfig.js.map +0 -1
- package/lib/defs/userRepresentation.js.map +0 -1
- package/lib/defs/userSessionRepresentation.js.map +0 -1
- package/lib/defs/whoAmIRepresentation.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/resources/agent.js.map +0 -1
- package/lib/resources/attackDetection.js.map +0 -1
- package/lib/resources/authenticationManagement.js.map +0 -1
- package/lib/resources/cache.js.map +0 -1
- package/lib/resources/clientPolicies.js.map +0 -1
- package/lib/resources/clientScopes.js.map +0 -1
- package/lib/resources/clients.js.map +0 -1
- package/lib/resources/components.js.map +0 -1
- package/lib/resources/groups.js.map +0 -1
- package/lib/resources/identityProviders.js.map +0 -1
- package/lib/resources/realms.js.map +0 -1
- package/lib/resources/resource.js.map +0 -1
- package/lib/resources/roles.js.map +0 -1
- package/lib/resources/serverInfo.js.map +0 -1
- package/lib/resources/sessions.d.ts +0 -10
- package/lib/resources/sessions.js +0 -16
- package/lib/resources/sessions.js.map +0 -1
- package/lib/resources/userStorageProvider.js.map +0 -1
- package/lib/resources/users.js.map +0 -1
- package/lib/resources/whoAmI.js.map +0 -1
- package/lib/utils/auth.js.map +0 -1
- package/lib/utils/constants.js.map +0 -1
- package/lib/utils/stringifyQueryParams.js.map +0 -1
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import type ClientRepresentation from
|
|
2
|
-
import type ComponentExportRepresentation from
|
|
3
|
-
import type UserRepresentation from
|
|
4
|
-
import type GroupRepresentation from
|
|
5
|
-
import type IdentityProviderRepresentation from
|
|
6
|
-
import type RequiredActionProviderRepresentation from
|
|
7
|
-
import type RolesRepresentation from
|
|
8
|
-
import type ClientProfilesRepresentation from
|
|
9
|
-
import type ClientPoliciesRepresentation from
|
|
10
|
-
import type RoleRepresentation from
|
|
1
|
+
import type ClientRepresentation from "./clientRepresentation.js";
|
|
2
|
+
import type ComponentExportRepresentation from "./componentExportRepresentation.js";
|
|
3
|
+
import type UserRepresentation from "./userRepresentation.js";
|
|
4
|
+
import type GroupRepresentation from "./groupRepresentation.js";
|
|
5
|
+
import type IdentityProviderRepresentation from "./identityProviderRepresentation.js";
|
|
6
|
+
import type RequiredActionProviderRepresentation from "./requiredActionProviderRepresentation.js";
|
|
7
|
+
import type RolesRepresentation from "./rolesRepresentation.js";
|
|
8
|
+
import type ClientProfilesRepresentation from "./clientProfilesRepresentation.js";
|
|
9
|
+
import type ClientPoliciesRepresentation from "./clientPoliciesRepresentation.js";
|
|
10
|
+
import type RoleRepresentation from "./roleRepresentation.js";
|
|
11
|
+
/**
|
|
12
|
+
* https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_realmrepresentation
|
|
13
|
+
*/
|
|
11
14
|
export default interface RealmRepresentation {
|
|
12
15
|
accessCodeLifespan?: number;
|
|
13
16
|
accessCodeLifespanLogin?: number;
|
|
@@ -68,6 +71,8 @@ export default interface RealmRepresentation {
|
|
|
68
71
|
maxFailureWaitSeconds?: number;
|
|
69
72
|
minimumQuickLoginWaitSeconds?: number;
|
|
70
73
|
notBefore?: number;
|
|
74
|
+
oauth2DeviceCodeLifespan?: number;
|
|
75
|
+
oauth2DevicePollingInterval?: number;
|
|
71
76
|
offlineSessionIdleTimeout?: number;
|
|
72
77
|
offlineSessionMaxLifespan?: number;
|
|
73
78
|
offlineSessionMaxLifespanEnabled?: boolean;
|
|
@@ -78,6 +83,7 @@ export default interface RealmRepresentation {
|
|
|
78
83
|
otpPolicyPeriod?: number;
|
|
79
84
|
otpPolicyType?: string;
|
|
80
85
|
otpSupportedApplications?: string[];
|
|
86
|
+
otpPolicyCodeReusable?: boolean;
|
|
81
87
|
passwordPolicy?: string;
|
|
82
88
|
permanentLockout?: boolean;
|
|
83
89
|
protocolMappers?: any[];
|
|
@@ -110,16 +116,16 @@ export default interface RealmRepresentation {
|
|
|
110
116
|
verifyEmail?: boolean;
|
|
111
117
|
waitIncrementSeconds?: number;
|
|
112
118
|
}
|
|
113
|
-
export
|
|
114
|
-
ifResourceExists:
|
|
119
|
+
export type PartialImportRealmRepresentation = RealmRepresentation & {
|
|
120
|
+
ifResourceExists: "FAIL" | "SKIP" | "OVERWRITE";
|
|
115
121
|
};
|
|
116
|
-
export
|
|
122
|
+
export type PartialImportResponse = {
|
|
117
123
|
overwritten: number;
|
|
118
124
|
added: number;
|
|
119
125
|
skipped: number;
|
|
120
126
|
results: PartialImportResult[];
|
|
121
127
|
};
|
|
122
|
-
export
|
|
128
|
+
export type PartialImportResult = {
|
|
123
129
|
action: string;
|
|
124
130
|
resourceType: string;
|
|
125
131
|
resourceName: string;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_requiredactionproviderrepresentation
|
|
3
|
+
*/
|
|
1
4
|
export declare enum RequiredActionAlias {
|
|
2
5
|
VERIFY_EMAIL = "VERIFY_EMAIL",
|
|
3
6
|
UPDATE_PROFILE = "UPDATE_PROFILE",
|
|
4
7
|
CONFIGURE_TOTP = "CONFIGURE_TOTP",
|
|
5
8
|
UPDATE_PASSWORD = "UPDATE_PASSWORD",
|
|
6
|
-
|
|
9
|
+
TERMS_AND_CONDITIONS = "TERMS_AND_CONDITIONS"
|
|
7
10
|
}
|
|
8
11
|
export default interface RequiredActionProviderRepresentation {
|
|
9
12
|
alias?: string;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_requiredactionproviderrepresentation
|
|
3
|
+
*/
|
|
1
4
|
export var RequiredActionAlias;
|
|
2
5
|
(function (RequiredActionAlias) {
|
|
3
6
|
RequiredActionAlias["VERIFY_EMAIL"] = "VERIFY_EMAIL";
|
|
4
7
|
RequiredActionAlias["UPDATE_PROFILE"] = "UPDATE_PROFILE";
|
|
5
8
|
RequiredActionAlias["CONFIGURE_TOTP"] = "CONFIGURE_TOTP";
|
|
6
9
|
RequiredActionAlias["UPDATE_PASSWORD"] = "UPDATE_PASSWORD";
|
|
7
|
-
RequiredActionAlias["
|
|
10
|
+
RequiredActionAlias["TERMS_AND_CONDITIONS"] = "TERMS_AND_CONDITIONS";
|
|
8
11
|
})(RequiredActionAlias = RequiredActionAlias || (RequiredActionAlias = {}));
|
|
9
|
-
//# sourceMappingURL=requiredActionProviderRepresentation.js.map
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_resourcerepresentation
|
|
3
|
+
*/
|
|
4
|
+
import type { ResourceOwnerRepresentation } from "./resourceServerRepresentation.js";
|
|
5
|
+
import type ScopeRepresentation from "./scopeRepresentation.js";
|
|
3
6
|
export default interface ResourceRepresentation {
|
|
4
7
|
name?: string;
|
|
5
8
|
type?: string;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_policyrepresentation
|
|
3
|
+
*/
|
|
4
|
+
import type PolicyRepresentation from "./policyRepresentation.js";
|
|
5
|
+
import type ResourceRepresentation from "./resourceRepresentation.js";
|
|
6
|
+
import type ScopeRepresentation from "./scopeRepresentation.js";
|
|
4
7
|
export default interface ResourceServerRepresentation {
|
|
5
8
|
id?: string;
|
|
6
9
|
clientId?: string;
|
|
@@ -30,7 +33,7 @@ export interface AbstractPolicyRepresentation {
|
|
|
30
33
|
resourcesData?: ResourceRepresentation[];
|
|
31
34
|
scopesData?: ScopeRepresentation[];
|
|
32
35
|
}
|
|
33
|
-
export
|
|
34
|
-
export
|
|
35
|
-
export
|
|
36
|
-
export
|
|
36
|
+
export type PolicyEnforcementMode = "ENFORCING" | "PERMISSIVE" | "DISABLED";
|
|
37
|
+
export type DecisionStrategy = "AFFIRMATIVE" | "UNANIMOUS" | "CONSENSUS";
|
|
38
|
+
export type Logic = "POSITIVE" | "NEGATIVE";
|
|
39
|
+
export type Category = "INTERNAL" | "ACCESS" | "ID" | "ADMIN" | "USERINFO";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_rolesrepresentation
|
|
3
|
+
*/
|
|
4
|
+
import type RoleRepresentation from "./roleRepresentation.js";
|
|
2
5
|
export default interface RolesRepresentation {
|
|
3
6
|
realm?: RoleRepresentation[];
|
|
4
7
|
client?: {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_scoperepresentation
|
|
3
|
+
*/
|
|
4
|
+
import type PolicyRepresentation from "./policyRepresentation.js";
|
|
5
|
+
import type ResourceRepresentation from "./resourceRepresentation.js";
|
|
3
6
|
export default interface ScopeRepresentation {
|
|
4
7
|
displayName?: string;
|
|
5
8
|
iconUri?: string;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import type ComponentTypeRepresentation from
|
|
2
|
-
import type { ConfigPropertyRepresentation } from
|
|
3
|
-
import type PasswordPolicyTypeRepresentation from
|
|
4
|
-
import type ProfileInfoRepresentation from
|
|
5
|
-
import type ProtocolMapperRepresentation from
|
|
6
|
-
import type SystemInfoRepresentation from
|
|
1
|
+
import type ComponentTypeRepresentation from "./componentTypeRepresentation.js";
|
|
2
|
+
import type { ConfigPropertyRepresentation } from "./configPropertyRepresentation.js";
|
|
3
|
+
import type PasswordPolicyTypeRepresentation from "./passwordPolicyTypeRepresentation.js";
|
|
4
|
+
import type ProfileInfoRepresentation from "./profileInfoRepresentation.js";
|
|
5
|
+
import type ProtocolMapperRepresentation from "./protocolMapperRepresentation.js";
|
|
6
|
+
import type SystemInfoRepresentation from "./systemInfoRepersantation.js";
|
|
7
|
+
/**
|
|
8
|
+
* https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_serverinforepresentation
|
|
9
|
+
*/
|
|
7
10
|
export interface ServerInfoRepresentation {
|
|
8
11
|
systemInfo?: SystemInfoRepresentation;
|
|
9
12
|
memoryInfo?: MemoryInfoRepresentation;
|
|
10
13
|
profileInfo?: ProfileInfoRepresentation;
|
|
14
|
+
cryptoInfo?: CryptoInfoRepresentation;
|
|
11
15
|
themes?: {
|
|
12
16
|
[index: string]: ThemeInfoRepresentation[];
|
|
13
17
|
};
|
|
@@ -80,3 +84,7 @@ export interface ProtocolMapperTypeRepresentation {
|
|
|
80
84
|
priority: number;
|
|
81
85
|
properties: ConfigPropertyRepresentation[];
|
|
82
86
|
}
|
|
87
|
+
export interface CryptoInfoRepresentation {
|
|
88
|
+
cryptoProvider: string;
|
|
89
|
+
supportedKeystoreTypes: string[];
|
|
90
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type UserConsentRepresentation from
|
|
2
|
-
import type CredentialRepresentation from
|
|
3
|
-
import type FederatedIdentityRepresentation from
|
|
4
|
-
import type { RequiredActionAlias } from
|
|
1
|
+
import type UserConsentRepresentation from "./userConsentRepresentation.js";
|
|
2
|
+
import type CredentialRepresentation from "./credentialRepresentation.js";
|
|
3
|
+
import type FederatedIdentityRepresentation from "./federatedIdentityRepresentation.js";
|
|
4
|
+
import type { RequiredActionAlias } from "./requiredActionProviderRepresentation.js";
|
|
5
5
|
export default interface UserRepresentation {
|
|
6
6
|
id?: string;
|
|
7
7
|
createdTimestamp?: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type AccessType = "view-realm" | "view-identity-providers" | "manage-identity-providers" | "impersonation" | "create-client" | "manage-users" | "query-realms" | "view-authorization" | "query-clients" | "query-users" | "manage-events" | "manage-realm" | "view-events" | "view-users" | "view-clients" | "manage-authorization" | "manage-clients" | "query-groups" | "anyone";
|
|
2
2
|
export default interface WhoAmIRepresentation {
|
|
3
3
|
userId: string;
|
|
4
4
|
realm: string;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { KeycloakAdminClient } from "./client.js";
|
|
2
|
+
import { RequiredActionAlias } from "./defs/requiredActionProviderRepresentation.js";
|
|
3
3
|
export declare const requiredAction: typeof RequiredActionAlias;
|
|
4
4
|
export default KeycloakAdminClient;
|
|
5
|
+
export { NetworkError } from "./utils/fetchWithError.js";
|
|
6
|
+
export type { NetworkErrorOptions } from "./utils/fetchWithError.js";
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { KeycloakAdminClient } from "./client.js";
|
|
2
|
+
import { RequiredActionAlias } from "./defs/requiredActionProviderRepresentation.js";
|
|
3
3
|
export const requiredAction = RequiredActionAlias;
|
|
4
4
|
export default KeycloakAdminClient;
|
|
5
|
-
|
|
5
|
+
export { NetworkError } from "./utils/fetchWithError.js";
|
package/lib/resources/agent.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { KeycloakAdminClient } from "../client.js";
|
|
2
|
+
type Method = "GET" | "POST" | "PUT" | "DELETE";
|
|
3
3
|
export interface RequestArgs {
|
|
4
4
|
method: Method;
|
|
5
5
|
path?: string;
|
|
@@ -11,8 +11,11 @@ export interface RequestArgs {
|
|
|
11
11
|
returnResourceIdInLocationHeader?: {
|
|
12
12
|
field: string;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Keys to be ignored, meaning that they will not be filtered out of the request payload even if they are a part of `urlParamKeys` or `queryParamKeys`,
|
|
16
|
+
*/
|
|
14
17
|
ignoredKeys?: string[];
|
|
15
|
-
headers?:
|
|
18
|
+
headers?: HeadersInit;
|
|
16
19
|
}
|
|
17
20
|
export declare class Agent {
|
|
18
21
|
private client;
|
|
@@ -25,8 +28,9 @@ export declare class Agent {
|
|
|
25
28
|
getUrlParams?: () => Record<string, any>;
|
|
26
29
|
getBaseUrl?: () => string;
|
|
27
30
|
});
|
|
28
|
-
request({ method, path, urlParamKeys, queryParamKeys, catchNotFound, keyTransform, payloadKey, returnResourceIdInLocationHeader, ignoredKeys, headers, }: RequestArgs): (payload?: any, options?: Pick<RequestArgs,
|
|
29
|
-
updateRequest({ method, path, urlParamKeys, queryParamKeys, catchNotFound, keyTransform, payloadKey, returnResourceIdInLocationHeader, headers }: RequestArgs): (query?: any, payload?: any) => Promise<any>;
|
|
31
|
+
request({ method, path, urlParamKeys, queryParamKeys, catchNotFound, keyTransform, payloadKey, returnResourceIdInLocationHeader, ignoredKeys, headers, }: RequestArgs): (payload?: any, options?: Pick<RequestArgs, "catchNotFound">) => Promise<any>;
|
|
32
|
+
updateRequest({ method, path, urlParamKeys, queryParamKeys, catchNotFound, keyTransform, payloadKey, returnResourceIdInLocationHeader, headers, }: RequestArgs): (query?: any, payload?: any) => Promise<any>;
|
|
30
33
|
private requestWithParams;
|
|
31
34
|
private transformKey;
|
|
32
35
|
}
|
|
36
|
+
export {};
|
package/lib/resources/agent.js
CHANGED
|
@@ -1,26 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { stringifyQueryParams } from
|
|
6
|
-
|
|
1
|
+
import { isUndefined, last, omit, pick } from "lodash-es";
|
|
2
|
+
import urlJoin from "url-join";
|
|
3
|
+
import { parseTemplate } from "url-template";
|
|
4
|
+
import { fetchWithError, NetworkError, parseResponse, } from "../utils/fetchWithError.js";
|
|
5
|
+
import { stringifyQueryParams } from "../utils/stringifyQueryParams.js";
|
|
6
|
+
// constants
|
|
7
|
+
const SLASH = "/";
|
|
7
8
|
export class Agent {
|
|
8
|
-
|
|
9
|
+
client;
|
|
10
|
+
basePath;
|
|
11
|
+
getBaseParams;
|
|
12
|
+
getBaseUrl;
|
|
13
|
+
constructor({ client, path = "/", getUrlParams = () => ({}), getBaseUrl = () => client.baseUrl, }) {
|
|
9
14
|
this.client = client;
|
|
10
15
|
this.getBaseParams = getUrlParams;
|
|
11
16
|
this.getBaseUrl = getBaseUrl;
|
|
12
17
|
this.basePath = path;
|
|
13
18
|
}
|
|
14
|
-
request({ method, path =
|
|
19
|
+
request({ method, path = "", urlParamKeys = [], queryParamKeys = [], catchNotFound = false, keyTransform, payloadKey, returnResourceIdInLocationHeader, ignoredKeys, headers, }) {
|
|
15
20
|
return async (payload = {}, options) => {
|
|
16
21
|
const baseParams = this.getBaseParams?.() ?? {};
|
|
17
|
-
|
|
22
|
+
// Filter query parameters by queryParamKeys
|
|
23
|
+
const queryParams = queryParamKeys
|
|
24
|
+
? pick(payload, queryParamKeys)
|
|
25
|
+
: undefined;
|
|
26
|
+
// Add filtered payload parameters to base parameters
|
|
18
27
|
const allUrlParamKeys = [...Object.keys(baseParams), ...urlParamKeys];
|
|
19
28
|
const urlParams = { ...baseParams, ...pick(payload, allUrlParamKeys) };
|
|
29
|
+
// Omit url parameters and query parameters from payload
|
|
20
30
|
const omittedKeys = ignoredKeys
|
|
21
31
|
? [...allUrlParamKeys, ...queryParamKeys].filter((key) => !ignoredKeys.includes(key))
|
|
22
32
|
: [...allUrlParamKeys, ...queryParamKeys];
|
|
23
33
|
payload = omit(payload, omittedKeys);
|
|
34
|
+
// Transform keys of both payload and queryParams
|
|
24
35
|
if (keyTransform) {
|
|
25
36
|
this.transformKey(payload, keyTransform);
|
|
26
37
|
this.transformKey(queryParams, keyTransform);
|
|
@@ -31,6 +42,7 @@ export class Agent {
|
|
|
31
42
|
payload,
|
|
32
43
|
urlParams,
|
|
33
44
|
queryParams,
|
|
45
|
+
// catchNotFound precedence: global > local > default
|
|
34
46
|
catchNotFound,
|
|
35
47
|
...(this.client.getGlobalRequestArgOptions() ?? options ?? {}),
|
|
36
48
|
payloadKey,
|
|
@@ -39,15 +51,20 @@ export class Agent {
|
|
|
39
51
|
});
|
|
40
52
|
};
|
|
41
53
|
}
|
|
42
|
-
updateRequest({ method, path =
|
|
54
|
+
updateRequest({ method, path = "", urlParamKeys = [], queryParamKeys = [], catchNotFound = false, keyTransform, payloadKey, returnResourceIdInLocationHeader, headers, }) {
|
|
43
55
|
return async (query = {}, payload = {}) => {
|
|
44
56
|
const baseParams = this.getBaseParams?.() ?? {};
|
|
45
|
-
|
|
57
|
+
// Filter query parameters by queryParamKeys
|
|
58
|
+
const queryParams = queryParamKeys
|
|
59
|
+
? pick(query, queryParamKeys)
|
|
60
|
+
: undefined;
|
|
61
|
+
// Add filtered query parameters to base parameters
|
|
46
62
|
const allUrlParamKeys = [...Object.keys(baseParams), ...urlParamKeys];
|
|
47
63
|
const urlParams = {
|
|
48
64
|
...baseParams,
|
|
49
65
|
...pick(query, allUrlParamKeys),
|
|
50
66
|
};
|
|
67
|
+
// Transform keys of queryParams
|
|
51
68
|
if (keyTransform) {
|
|
52
69
|
this.transformKey(queryParams, keyTransform);
|
|
53
70
|
}
|
|
@@ -64,54 +81,76 @@ export class Agent {
|
|
|
64
81
|
});
|
|
65
82
|
};
|
|
66
83
|
}
|
|
67
|
-
async requestWithParams({ method, path, payload, urlParams, queryParams, catchNotFound, payloadKey, returnResourceIdInLocationHeader, headers }) {
|
|
84
|
+
async requestWithParams({ method, path, payload, urlParams, queryParams, catchNotFound, payloadKey, returnResourceIdInLocationHeader, headers, }) {
|
|
68
85
|
const newPath = urlJoin(this.basePath, path);
|
|
86
|
+
// Parse template and replace with values from urlParams
|
|
69
87
|
const pathTemplate = parseTemplate(newPath);
|
|
70
88
|
const parsedPath = pathTemplate.expand(urlParams);
|
|
71
|
-
const url = `${this.getBaseUrl?.() ??
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
...(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
const url = new URL(`${this.getBaseUrl?.() ?? ""}${parsedPath}`);
|
|
90
|
+
const requestOptions = { ...this.client.getRequestOptions() };
|
|
91
|
+
const requestHeaders = new Headers([
|
|
92
|
+
...new Headers(requestOptions.headers).entries(),
|
|
93
|
+
["authorization", `Bearer ${await this.client.getAccessToken()}`],
|
|
94
|
+
["accept", "application/json, text/plain, */*"],
|
|
95
|
+
...new Headers(headers).entries(),
|
|
96
|
+
]);
|
|
97
|
+
const searchParams = {};
|
|
98
|
+
// Add payload parameters to search params if method is 'GET'.
|
|
99
|
+
if (method === "GET") {
|
|
100
|
+
Object.assign(searchParams, payload);
|
|
101
|
+
}
|
|
102
|
+
else if (requestHeaders.get("content-type") === "text/plain") {
|
|
103
|
+
// Pass the payload as a plain string if the content type is 'text/plain'.
|
|
104
|
+
requestOptions.body = payload;
|
|
105
|
+
}
|
|
106
|
+
else if (payload instanceof FormData) {
|
|
107
|
+
requestOptions.body = payload;
|
|
85
108
|
}
|
|
86
109
|
else {
|
|
87
|
-
|
|
110
|
+
// Otherwise assume it's JSON and stringify it.
|
|
111
|
+
requestOptions.body = JSON.stringify(payloadKey ? payload[payloadKey] : payload);
|
|
112
|
+
}
|
|
113
|
+
if (!requestHeaders.has("content-type") && !(payload instanceof FormData)) {
|
|
114
|
+
requestHeaders.set("content-type", "application/json");
|
|
88
115
|
}
|
|
89
116
|
if (queryParams) {
|
|
90
|
-
|
|
91
|
-
? {
|
|
92
|
-
...requestConfig.params,
|
|
93
|
-
...queryParams,
|
|
94
|
-
}
|
|
95
|
-
: queryParams;
|
|
117
|
+
Object.assign(searchParams, queryParams);
|
|
96
118
|
}
|
|
119
|
+
url.search = stringifyQueryParams(searchParams);
|
|
97
120
|
try {
|
|
98
|
-
const res = await
|
|
121
|
+
const res = await fetchWithError(url, {
|
|
122
|
+
...requestOptions,
|
|
123
|
+
headers: requestHeaders,
|
|
124
|
+
method,
|
|
125
|
+
});
|
|
126
|
+
// now we get the response of the http request
|
|
127
|
+
// if `resourceIdInLocationHeader` is true, we'll get the resourceId from the location header field
|
|
128
|
+
// todo: find a better way to find the id in path, maybe some kind of pattern matching
|
|
129
|
+
// for now, we simply split the last sub-path of the path returned in location header field
|
|
99
130
|
if (returnResourceIdInLocationHeader) {
|
|
100
|
-
const locationHeader = res.headers.location;
|
|
101
|
-
if (typeof locationHeader !==
|
|
102
|
-
throw new Error(`location header is not found in request: ${res.
|
|
131
|
+
const locationHeader = res.headers.get("location");
|
|
132
|
+
if (typeof locationHeader !== "string") {
|
|
133
|
+
throw new Error(`location header is not found in request: ${res.url}`);
|
|
103
134
|
}
|
|
104
135
|
const resourceId = last(locationHeader.split(SLASH));
|
|
105
136
|
if (!resourceId) {
|
|
106
|
-
throw
|
|
137
|
+
// throw an error to let users know the response is not expected
|
|
138
|
+
throw new Error(`resourceId is not found in Location header from request: ${res.url}`);
|
|
107
139
|
}
|
|
140
|
+
// return with format {[field]: string}
|
|
108
141
|
const { field } = returnResourceIdInLocationHeader;
|
|
109
142
|
return { [field]: resourceId };
|
|
110
143
|
}
|
|
111
|
-
|
|
144
|
+
if (Object.entries(headers || []).find(([key, value]) => key.toLowerCase() === "accept" &&
|
|
145
|
+
value === "application/octet-stream")) {
|
|
146
|
+
return res.arrayBuffer();
|
|
147
|
+
}
|
|
148
|
+
return parseResponse(res);
|
|
112
149
|
}
|
|
113
150
|
catch (err) {
|
|
114
|
-
if (
|
|
151
|
+
if (err instanceof NetworkError &&
|
|
152
|
+
err.response.status === 404 &&
|
|
153
|
+
catchNotFound) {
|
|
115
154
|
return null;
|
|
116
155
|
}
|
|
117
156
|
throw err;
|
|
@@ -123,6 +162,7 @@ export class Agent {
|
|
|
123
162
|
}
|
|
124
163
|
Object.keys(keyMapping).some((key) => {
|
|
125
164
|
if (isUndefined(payload[key])) {
|
|
165
|
+
// Skip if undefined
|
|
126
166
|
return false;
|
|
127
167
|
}
|
|
128
168
|
const newKey = keyMapping[key];
|
|
@@ -131,4 +171,3 @@ export class Agent {
|
|
|
131
171
|
});
|
|
132
172
|
}
|
|
133
173
|
}
|
|
134
|
-
//# sourceMappingURL=agent.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Resource from
|
|
2
|
-
import type KeycloakAdminClient from
|
|
1
|
+
import Resource from "./resource.js";
|
|
2
|
+
import type KeycloakAdminClient from "../index.js";
|
|
3
3
|
export declare class AttackDetection extends Resource<{
|
|
4
4
|
realm?: string;
|
|
5
5
|
}> {
|