From 943115f696cd5384d98ce07d69889c3260a6b61c Mon Sep 17 00:00:00 2001 From: Oleksii Nikiforov Date: Sat, 30 Nov 2024 10:03:35 +0200 Subject: [PATCH] fix: Fix relative Urls for SDK clients (#158) --- docs-reference | 1 + src/Keycloak.AuthServices.Sdk/Protection/ApiUrls.cs | 4 ++-- src/Keycloak.AuthServices.Sdk/ServiceCollectionExtensions.cs | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) create mode 160000 docs-reference diff --git a/docs-reference b/docs-reference new file mode 160000 index 00000000..c2182122 --- /dev/null +++ b/docs-reference @@ -0,0 +1 @@ +Subproject commit c21821223d1fde0c1ac172d47d053991c5aea248 diff --git a/src/Keycloak.AuthServices.Sdk/Protection/ApiUrls.cs b/src/Keycloak.AuthServices.Sdk/Protection/ApiUrls.cs index b7357588..e707fe50 100644 --- a/src/Keycloak.AuthServices.Sdk/Protection/ApiUrls.cs +++ b/src/Keycloak.AuthServices.Sdk/Protection/ApiUrls.cs @@ -6,7 +6,7 @@ namespace Keycloak.AuthServices.Sdk.Protection; internal static class ApiUrls { #region ProtectedResource - internal const string GetResources = "/realms/{realm}/authz/protection/resource_set"; + internal const string GetResources = "realms/{realm}/authz/protection/resource_set"; internal const string GetResource = $"{GetResources}/{{id}}"; @@ -18,7 +18,7 @@ internal static class ApiUrls #endregion #region Policy - internal const string GetPolicies = "/realms/{realm}/authz/protection/uma-policy"; + internal const string GetPolicies = "realms/{realm}/authz/protection/uma-policy"; internal const string GetPolicy = $"{GetPolicies}/{{id}}"; diff --git a/src/Keycloak.AuthServices.Sdk/ServiceCollectionExtensions.cs b/src/Keycloak.AuthServices.Sdk/ServiceCollectionExtensions.cs index aec3f018..0b4e310a 100644 --- a/src/Keycloak.AuthServices.Sdk/ServiceCollectionExtensions.cs +++ b/src/Keycloak.AuthServices.Sdk/ServiceCollectionExtensions.cs @@ -76,7 +76,7 @@ public static IHttpClientBuilder AddKeycloakAdminHttpClient( IOptions >(); - http.BaseAddress = new Uri(keycloakOptions.Value.KeycloakUrlRealm); + http.BaseAddress = new Uri(keycloakOptions.Value.AuthServerUrl!); configureClient?.Invoke(http); } ) @@ -178,7 +178,7 @@ public static IHttpClientBuilder AddKeycloakProtectionHttpClient( IOptions >(); - http.BaseAddress = new Uri(keycloakOptions.Value.KeycloakUrlRealm); + http.BaseAddress = new Uri(keycloakOptions.Value.AuthServerUrl!); configureClient?.Invoke(http); } )