Skip to main content

Definition

Assembly: Microsoft.OData.Mcp.Authentication.dll Namespace: Microsoft.OData.Mcp.Authentication.Models Inheritance: System.Object

Syntax

Summary

Defines scope requirements for operations on a specific entity type.

Remarks

Entity scope requirements allow fine-grained authorization control at the entity level, enabling different access policies for different types of data within the same OData service.

Constructors

.ctor

Initializes a new instance of the EntityScopeRequirements class.

Syntax

.ctor

Initializes a new instance of the EntityScopeRequirements class with the same scopes for all operations.

Syntax

Parameters

Exceptions

.ctor

Initializes a new instance of the EntityScopeRequirements class with separate read and write scopes.

Syntax

Parameters

Exceptions

.ctor Inherited

Inherited from object

Syntax

Properties

CreateScopes

Gets or sets the scopes required for creating entities of this type.

Syntax

Property Value

Type: System.Collections.Generic.List<string> A collection of scopes that allow create access to the entity.

Remarks

Users must have at least one of these scopes to create new instances of this entity type.

CustomOperationScopes

Gets or sets custom scope requirements for specific operations.

Syntax

Property Value

Type: System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> A mapping of custom operation names to their required scopes.

Remarks

This allows defining scope requirements for custom operations beyond the standard CRUD operations. The operation names should match those used in the MCP tool definitions.

DeleteScopes

Gets or sets the scopes required for deleting entities of this type.

Syntax

Property Value

Type: System.Collections.Generic.List<string> A collection of scopes that allow delete access to the entity.

Remarks

Users must have at least one of these scopes to delete instances of this entity type. Gets or sets the scopes required for navigating to related entities.

Syntax

Property Value

Type: System.Collections.Generic.List<string> A collection of scopes that allow navigation to related entities.

Remarks

Users must have at least one of these scopes to follow navigation properties from this entity type to related entities.

QueryScopes

Gets or sets the scopes required for querying entities of this type.

Syntax

Property Value

Type: System.Collections.Generic.List<string> A collection of scopes that allow query access to the entity.

Remarks

Users must have at least one of these scopes to perform complex queries, filtering, and sorting on this entity type.

ReadScopes

Gets or sets the scopes required for reading entities of this type.

Syntax

Property Value

Type: System.Collections.Generic.List<string> A collection of scopes that allow read access to the entity.

Remarks

Users must have at least one of these scopes to query, retrieve, or navigate to entities of this type.

UpdateScopes

Gets or sets the scopes required for updating entities of this type.

Syntax

Property Value

Type: System.Collections.Generic.List<string> A collection of scopes that allow update access to the entity.

Remarks

Users must have at least one of these scopes to modify existing instances of this entity type.

Methods

AddCustomOperation

Adds a custom operation with its required scopes.

Syntax

Parameters

Exceptions

Equals Inherited Virtual

Inherited from object

Syntax

Parameters

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

GetAllScopes

Gets all unique scopes defined for this entity across all operations.

Syntax

Returns

Type: System.Collections.Generic.IEnumerable<string> A collection of all unique scopes defined for this entity.

GetHashCode Inherited Virtual

Inherited from object

Syntax

Returns

Type: int

GetScopesForOperation

Gets the required scopes for a specific operation.

Syntax

Parameters

Returns

Type: System.Collections.Generic.IEnumerable<string> The required scopes for the operation, or an empty collection if no specific requirement exists.

GetType Inherited

Inherited from object

Syntax

Returns

Type: System.Type

HasAnyScopes

Determines whether any scopes are defined for this entity.

Syntax

Returns

Type: bool true if any scopes are defined; otherwise, false.

MemberwiseClone Inherited

Inherited from object

Syntax

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

SetScopesForOperation

Sets the required scopes for a specific operation.

Syntax

Parameters

Exceptions

ToString Override

Returns a string representation of the entity scope requirements.

Syntax

Returns

Type: string A summary of the scope requirements for this entity.

ToString Inherited Virtual

Inherited from object

Syntax

Returns

Type: string?

Validate

Validates the entity scope requirements for consistency and completeness.

Syntax

Returns

Type: System.Collections.Generic.IEnumerable<string> A collection of validation errors, or an empty collection if the requirements are valid.