Table of Contents

Class PoliciesBuilderExtensions

Namespace
Keycloak.AuthServices.Authorization
Assembly
Keycloak.AuthServices.Authorization.dll
public static class PoliciesBuilderExtensions
Inheritance
PoliciesBuilderExtensions
Inherited Members

Methods

RequireProtectedResource(AuthorizationPolicyBuilder, string, string)

Adds protected resource requirement to builder. Makes outgoing HTTP requests to Authorization Server.

public static AuthorizationPolicyBuilder RequireProtectedResource(this AuthorizationPolicyBuilder builder, string resource, string scope)

Parameters

builder AuthorizationPolicyBuilder
resource string
scope string

Returns

AuthorizationPolicyBuilder

RequireProtectedResource(AuthorizationPolicyBuilder, string, string[], ScopesValidationMode?)

Adds protected resource requirement to builder. Makes outgoing HTTP requests to Authorization Server.

public static AuthorizationPolicyBuilder RequireProtectedResource(this AuthorizationPolicyBuilder builder, string resource, string[] scopes, ScopesValidationMode? scopesValidationMode = null)

Parameters

builder AuthorizationPolicyBuilder
resource string
scopes string[]
scopesValidationMode ScopesValidationMode?

Returns

AuthorizationPolicyBuilder

RequireRealmRoles(AuthorizationPolicyBuilder, params string[])

Adds realm role requirement to builder. Ensures that at least one realm role is present in realm claims.

public static AuthorizationPolicyBuilder RequireRealmRoles(this AuthorizationPolicyBuilder builder, params string[] roles)

Parameters

builder AuthorizationPolicyBuilder
roles string[]

Returns

AuthorizationPolicyBuilder

RequireResourceRoles(AuthorizationPolicyBuilder, params string[])

Adds resource role requirement to builder. Ensures that at least one resource role is present in resource claims. Note, make sure role source is configure. See documentation for more details.

public static AuthorizationPolicyBuilder RequireResourceRoles(this AuthorizationPolicyBuilder builder, params string[] roles)

Parameters

builder AuthorizationPolicyBuilder
roles string[]

Returns

AuthorizationPolicyBuilder

RequireResourceRolesForClient(AuthorizationPolicyBuilder, string, string[])

Adds resource role requirement to builder. Ensures that at least one resource role is present in resource claims.

public static AuthorizationPolicyBuilder RequireResourceRolesForClient(this AuthorizationPolicyBuilder builder, string client, string[] roles)

Parameters

builder AuthorizationPolicyBuilder
client string
roles string[]

Returns

AuthorizationPolicyBuilder