diff --git a/src/Aspire.Hosting.Keycloak/Aspire.Hosting.Keycloak.csproj b/src/Aspire.Hosting.Keycloak/Aspire.Hosting.Keycloak.csproj index 2456938c34..923fe66d01 100644 --- a/src/Aspire.Hosting.Keycloak/Aspire.Hosting.Keycloak.csproj +++ b/src/Aspire.Hosting.Keycloak/Aspire.Hosting.Keycloak.csproj @@ -1,8 +1,9 @@ - + $(NetCurrent) true + true aspire hosting keycloak Keycloak support for .NET Aspire. diff --git a/src/Components/Aspire.Keycloak.Authentication/Aspire.Keycloak.Authentication.csproj b/src/Components/Aspire.Keycloak.Authentication/Aspire.Keycloak.Authentication.csproj index ff38cc9383..88c745c5b1 100644 --- a/src/Components/Aspire.Keycloak.Authentication/Aspire.Keycloak.Authentication.csproj +++ b/src/Components/Aspire.Keycloak.Authentication/Aspire.Keycloak.Authentication.csproj @@ -3,6 +3,7 @@ $(NetCurrent) true + true $(ComponentCommonPackageTags) Keycloak Configures Keycloak as the authentication provider for ASP.NET Core applications. @@ -13,10 +14,6 @@ 80 - - - - diff --git a/src/Components/Aspire.Keycloak.Authentication/AspireKeycloakExtensions.cs b/src/Components/Aspire.Keycloak.Authentication/AspireKeycloakExtensions.cs index cbbf65a250..36b27e170a 100644 --- a/src/Components/Aspire.Keycloak.Authentication/AspireKeycloakExtensions.cs +++ b/src/Components/Aspire.Keycloak.Authentication/AspireKeycloakExtensions.cs @@ -27,7 +27,7 @@ public static class AspireKeycloakExtensions /// For example, if is "keycloak" and is "myrealm", the authority URL will be "https+http://keycloak/realms/myrealm". /// public static AuthenticationBuilder AddKeycloakJwtBearer(this AuthenticationBuilder builder, string serviceName, string realm) - => builder.AddKeycloakJwtBearer(serviceName, realm, JwtBearerDefaults.AuthenticationScheme, _ => { }); + => builder.AddKeycloakJwtBearer(serviceName, realm, JwtBearerDefaults.AuthenticationScheme, null); /// /// Adds Keycloak JWT Bearer authentication to the application. @@ -41,7 +41,7 @@ public static AuthenticationBuilder AddKeycloakJwtBearer(this AuthenticationBuil /// For example, if is "keycloak" and is "myrealm", the authority URL will be "https+http://keycloak/realms/myrealm". /// public static AuthenticationBuilder AddKeycloakJwtBearer(this AuthenticationBuilder builder, string serviceName, string realm, string authenticationScheme) - => builder.AddKeycloakJwtBearer(serviceName, realm, authenticationScheme, _ => { }); + => builder.AddKeycloakJwtBearer(serviceName, realm, authenticationScheme, null); /// /// Adds Keycloak JWT Bearer authentication to the application. @@ -54,7 +54,7 @@ public static AuthenticationBuilder AddKeycloakJwtBearer(this AuthenticationBuil /// The is used to resolve the Keycloak server URL and is combined with the realm to form the authority URL. /// For example, if is "keycloak" and is "myrealm", the authority URL will be "https+http://keycloak/realms/myrealm". /// - public static AuthenticationBuilder AddKeycloakJwtBearer(this AuthenticationBuilder builder, string serviceName, string realm, Action configureOptions) + public static AuthenticationBuilder AddKeycloakJwtBearer(this AuthenticationBuilder builder, string serviceName, string realm, Action? configureOptions) => builder.AddKeycloakJwtBearer(serviceName, realm, JwtBearerDefaults.AuthenticationScheme, configureOptions); /// @@ -74,7 +74,7 @@ public static AuthenticationBuilder AddKeycloakJwtBearer( string serviceName, string realm, string authenticationScheme, - Action configureOptions) + Action? configureOptions) { ArgumentNullException.ThrowIfNull(builder); @@ -106,7 +106,7 @@ public static AuthenticationBuilder AddKeycloakJwtBearer( /// For example, if is "keycloak" and is "myrealm", the authority URL will be "https+http://keycloak/realms/myrealm". /// public static AuthenticationBuilder AddKeycloakOpenIdConnect(this AuthenticationBuilder builder, string serviceName, string realm) - => builder.AddKeycloakOpenIdConnect(serviceName, realm, OpenIdConnectDefaults.AuthenticationScheme, _ => { }); + => builder.AddKeycloakOpenIdConnect(serviceName, realm, OpenIdConnectDefaults.AuthenticationScheme, null); /// /// Adds Keycloak OpenID Connect authentication to the application. @@ -120,7 +120,7 @@ public static AuthenticationBuilder AddKeycloakOpenIdConnect(this Authentication /// For example, if is "keycloak" and is "myrealm", the authority URL will be "https+http://keycloak/realms/myrealm". /// public static AuthenticationBuilder AddKeycloakOpenIdConnect(this AuthenticationBuilder builder, string serviceName, string realm, string authenticationScheme) - => builder.AddKeycloakOpenIdConnect(serviceName, realm, authenticationScheme, _ => { }); + => builder.AddKeycloakOpenIdConnect(serviceName, realm, authenticationScheme, null); /// /// Adds Keycloak OpenID Connect authentication to the application. @@ -133,7 +133,7 @@ public static AuthenticationBuilder AddKeycloakOpenIdConnect(this Authentication /// The is used to resolve the Keycloak server URL and is combined with the realm to form the authority URL. /// For example, if is "keycloak" and is "myrealm", the authority URL will be "https+http://keycloak/realms/myrealm". /// - public static AuthenticationBuilder AddKeycloakOpenIdConnect(this AuthenticationBuilder builder, string serviceName, string realm, Action configureOptions) + public static AuthenticationBuilder AddKeycloakOpenIdConnect(this AuthenticationBuilder builder, string serviceName, string realm, Action? configureOptions) => builder.AddKeycloakOpenIdConnect(serviceName, realm, OpenIdConnectDefaults.AuthenticationScheme, configureOptions); /// @@ -153,7 +153,7 @@ public static AuthenticationBuilder AddKeycloakOpenIdConnect( string serviceName, string realm, string authenticationScheme, - Action configureOptions) + Action? configureOptions) { ArgumentNullException.ThrowIfNull(builder); diff --git a/src/Components/Aspire.Keycloak.Authentication/PublicAPI.Unshipped.txt b/src/Components/Aspire.Keycloak.Authentication/PublicAPI.Unshipped.txt index 6c67497ed0..9f932fb7a0 100644 --- a/src/Components/Aspire.Keycloak.Authentication/PublicAPI.Unshipped.txt +++ b/src/Components/Aspire.Keycloak.Authentication/PublicAPI.Unshipped.txt @@ -2,9 +2,9 @@ Microsoft.Extensions.DependencyInjection.AspireKeycloakExtensions static Microsoft.Extensions.DependencyInjection.AspireKeycloakExtensions.AddKeycloakJwtBearer(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder! builder, string! serviceName, string! realm) -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder! static Microsoft.Extensions.DependencyInjection.AspireKeycloakExtensions.AddKeycloakJwtBearer(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder! builder, string! serviceName, string! realm, string! authenticationScheme) -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder! -static Microsoft.Extensions.DependencyInjection.AspireKeycloakExtensions.AddKeycloakJwtBearer(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder! builder, string! serviceName, string! realm, string! authenticationScheme, System.Action! configureOptions) -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder! -static Microsoft.Extensions.DependencyInjection.AspireKeycloakExtensions.AddKeycloakJwtBearer(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder! builder, string! serviceName, string! realm, System.Action! configureOptions) -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder! +static Microsoft.Extensions.DependencyInjection.AspireKeycloakExtensions.AddKeycloakJwtBearer(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder! builder, string! serviceName, string! realm, string! authenticationScheme, System.Action? configureOptions) -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder! +static Microsoft.Extensions.DependencyInjection.AspireKeycloakExtensions.AddKeycloakJwtBearer(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder! builder, string! serviceName, string! realm, System.Action? configureOptions) -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder! static Microsoft.Extensions.DependencyInjection.AspireKeycloakExtensions.AddKeycloakOpenIdConnect(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder! builder, string! serviceName, string! realm) -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder! static Microsoft.Extensions.DependencyInjection.AspireKeycloakExtensions.AddKeycloakOpenIdConnect(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder! builder, string! serviceName, string! realm, string! authenticationScheme) -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder! -static Microsoft.Extensions.DependencyInjection.AspireKeycloakExtensions.AddKeycloakOpenIdConnect(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder! builder, string! serviceName, string! realm, string! authenticationScheme, System.Action! configureOptions) -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder! -static Microsoft.Extensions.DependencyInjection.AspireKeycloakExtensions.AddKeycloakOpenIdConnect(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder! builder, string! serviceName, string! realm, System.Action! configureOptions) -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder! \ No newline at end of file +static Microsoft.Extensions.DependencyInjection.AspireKeycloakExtensions.AddKeycloakOpenIdConnect(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder! builder, string! serviceName, string! realm, string! authenticationScheme, System.Action? configureOptions) -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder! +static Microsoft.Extensions.DependencyInjection.AspireKeycloakExtensions.AddKeycloakOpenIdConnect(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder! builder, string! serviceName, string! realm, System.Action? configureOptions) -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder! \ No newline at end of file diff --git a/src/Components/Aspire.Keycloak.Authentication/README.md b/src/Components/Aspire.Keycloak.Authentication/README.md index 2a5f9d4282..1cc59e8b8a 100644 --- a/src/Components/Aspire.Keycloak.Authentication/README.md +++ b/src/Components/Aspire.Keycloak.Authentication/README.md @@ -1,4 +1,4 @@ -# Aspire.Keycloak library +# Aspire.Keycloak.Authentication library Adds JwtBearer and OpenId Connect authentication to the project via a [Keycloak](https://www.keycloak.org). @@ -16,7 +16,7 @@ Adds JwtBearer and OpenId Connect authentication to the project via a [Keycloak] Install the .NET Aspire Keycloak library with [NuGet](https://www.nuget.org): ```dotnetcli -dotnet add package Aspire.Keycloak +dotnet add package Aspire.Keycloak.Authentication ``` ## Jwt bearer authentication usage example @@ -104,4 +104,4 @@ builder.Services.AddAuthentication(oidcScheme) ## Feedback & contributing -https://github.com/dotnet/aspire \ No newline at end of file +https://github.com/dotnet/aspire