Show / Hide Table of Contents

Class SecurityExtensions

Inheritance
System.Object
SecurityExtensions
Namespace:InfinniPlatform.Security
Assembly:InfinniPlatform.Core.Abstractions.dll
Syntax
public static class SecurityExtensions : object

Methods

| Improve this Doc View Source

AddClaim(IIdentity, String, String)

Добавляет утверждение заданного типа.

Declaration
public static void AddClaim(this IIdentity identity, string claimType, string claimValue)
Parameters
Type Name Description
IIdentity identity

Объект идентификации.

System.String claimType

Тип утверждения (например, ).

System.String claimValue

Значение утверждения.

| Improve this Doc View Source

AddOrUpdateClaim(IIdentity, String, String)

Добавляет или обновляет утверждения заданного типа.

Declaration
public static void AddOrUpdateClaim(this IIdentity identity, string claimType, string claimValue)
Parameters
Type Name Description
IIdentity identity

Объект идентификации.

System.String claimType

Тип утверждения (например, ).

System.String claimValue

Значение утверждения.

| Improve this Doc View Source

FindAllClaims(IIdentity, String)

Возвращает все утверждения заданного типа.

Declaration
public static IEnumerable<string> FindAllClaims(this IIdentity identity, string claimType)
Parameters
Type Name Description
IIdentity identity

Объект идентификации.

System.String claimType

Тип утверждения (например, ).

Returns
Type Description
IEnumerable<System.String>

Значения утверждений.

| Improve this Doc View Source

FindAllClaims<T>(IIdentity, String)

Возвращает все утверждения заданного типа.

Declaration
public static IEnumerable<T> FindAllClaims<T>(this IIdentity identity, string claimType)
Parameters
Type Name Description
IIdentity identity

Объект идентификации.

System.String claimType

Тип утверждения (например, ).

Returns
Type Description
IEnumerable<T>

Значения утверждений.

Type Parameters
Name Description
T

Тип значения утверждения.

| Improve this Doc View Source

FindFirstClaim(IIdentity, String)

Возвращает первое утверждение заданного типа.

Declaration
public static string FindFirstClaim(this IIdentity identity, string claimType)
Parameters
Type Name Description
IIdentity identity

Объект идентификации.

System.String claimType

Тип утверждения (например, ).

Returns
Type Description
System.String

Значение утверждения.

| Improve this Doc View Source

FindFirstClaim<T>(IIdentity, String)

Возвращает первое утверждение заданного типа.

Declaration
public static T FindFirstClaim<T>(this IIdentity identity, string claimType)
Parameters
Type Name Description
IIdentity identity

Объект идентификации.

System.String claimType

Тип утверждения (например, ).

Returns
Type Description
T

Значение утверждения.

Type Parameters
Name Description
T

Тип значения утверждения.

| Improve this Doc View Source

GetUserId(IIdentity)

Возвращает уникальный идентификатор пользователя.

Declaration
public static string GetUserId(this IIdentity identity)
Parameters
Type Name Description
IIdentity identity

Объект идентификации.

Returns
Type Description
System.String
| Improve this Doc View Source

HasAllClaims(IIdentity, IEnumerable<String>)

Проверяет наличие всех заданных типов утверждений.

Declaration
public static bool HasAllClaims(this IIdentity identity, IEnumerable<string> claimTypes)
Parameters
Type Name Description
IIdentity identity

Объект идентификации.

IEnumerable<System.String> claimTypes

Типы утверждений (например, ).

Returns
Type Description
System.Boolean
| Improve this Doc View Source

HasAnyClaims(IIdentity, IEnumerable<String>)

Проверяет наличие любого заданного типа утверждения.

Declaration
public static bool HasAnyClaims(this IIdentity identity, IEnumerable<string> claimTypes)
Parameters
Type Name Description
IIdentity identity

Объект идентификации.

IEnumerable<System.String> claimTypes

Типы утверждений (например, ).

Returns
Type Description
System.Boolean
| Improve this Doc View Source

HasClaim(IIdentity, String)

Проверяет наличие заданного типа утверждения.

Declaration
public static bool HasClaim(this IIdentity identity, string claimType)
Parameters
Type Name Description
IIdentity identity

Объект идентификации.

System.String claimType

Тип утверждения (например, ).

Returns
Type Description
System.Boolean
| Improve this Doc View Source

HasClaim(IIdentity, String, String)

Проверяет наличие заданного типа утверждения.

Declaration
public static bool HasClaim(this IIdentity identity, string claimType, string claimValue)
Parameters
Type Name Description
IIdentity identity

Объект идентификации.

System.String claimType

Тип утверждения (например, ).

System.String claimValue

Значение утверждения.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

RemoveClaims(IIdentity, String, Func<String, Boolean>)

Удаляет утверждения заданного типа.

Declaration
public static void RemoveClaims(this IIdentity identity, string claimType, Func<string, bool> claimValueMatch = null)
Parameters
Type Name Description
IIdentity identity

Объект идентификации.

System.String claimType

Тип утверждения (например, ).

Func<System.String, System.Boolean> claimValueMatch

Функция выборки утверждений, которые следует удалить.

| Improve this Doc View Source

RequiresAllClaims(IHttpServiceBuilder, IEnumerable<String>)

Устанавливает необходимость наличия у пользователя всех заданных типов утверждений.

Declaration
public static void RequiresAllClaims(this IHttpServiceBuilder target, IEnumerable<string> claimTypes)
Parameters
Type Name Description
IHttpServiceBuilder target
IEnumerable<System.String> claimTypes
Remarks

Если пользователь не идентифицирован, клиенту будет возвращен ответ Unauthorized. Если пользователь не имеет всех утверждений заданных типов, клиенту будет возвращен ответ Forbidden.

| Improve this Doc View Source

RequiresAllClaims(IHttpServiceBuilder, String[])

Устанавливает необходимость наличия у пользователя всех заданных типов утверждений.

Declaration
public static void RequiresAllClaims(this IHttpServiceBuilder target, params string[] claimTypes)
Parameters
Type Name Description
IHttpServiceBuilder target
System.String[] claimTypes
Remarks

Если пользователь не идентифицирован, клиенту будет возвращен ответ Unauthorized. Если пользователь не имеет всех утверждений заданных типов, клиенту будет возвращен ответ Forbidden.

| Improve this Doc View Source

RequiresAnyClaims(IHttpServiceBuilder, IEnumerable<String>)

Устанавливает необходимость наличия у пользователя одного из заданных типов утверждений.

Declaration
public static void RequiresAnyClaims(this IHttpServiceBuilder target, IEnumerable<string> claimTypes)
Parameters
Type Name Description
IHttpServiceBuilder target
IEnumerable<System.String> claimTypes
Remarks

Если пользователь не идентифицирован, клиенту будет возвращен ответ Unauthorized. Если пользователь не имеет ни одного утверждения из заданных типов, клиенту будет возвращен ответ Forbidden.

| Improve this Doc View Source

RequiresAnyClaims(IHttpServiceBuilder, String[])

Устанавливает необходимость наличия у пользователя одного из заданных типов утверждений.

Declaration
public static void RequiresAnyClaims(this IHttpServiceBuilder target, params string[] claimTypes)
Parameters
Type Name Description
IHttpServiceBuilder target
System.String[] claimTypes
Remarks

Если пользователь не идентифицирован, клиенту будет возвращен ответ Unauthorized. Если пользователь не имеет ни одного утверждения из заданных типов, клиенту будет возвращен ответ Forbidden.

| Improve this Doc View Source

RequiresAuthentication(IHttpServiceBuilder)

Устанавливает необходимость аутентификации пользователя.

Declaration
public static void RequiresAuthentication(this IHttpServiceBuilder target)
Parameters
Type Name Description
IHttpServiceBuilder target
Remarks

Если пользователь не идентифицирован, клиенту будет возвращен ответ Unauthorized.

| Improve this Doc View Source

RequiresClaim(IHttpServiceBuilder, String)

Устанавливает необходимость наличия у пользователя заданного типа утверждения.

Declaration
public static void RequiresClaim(this IHttpServiceBuilder target, string claimType)
Parameters
Type Name Description
IHttpServiceBuilder target
System.String claimType
Remarks

Если пользователь не идентифицирован, клиенту будет возвращен ответ Unauthorized. Если пользователь не имеет утверждения заданного типа, клиенту будет возвращен ответ Forbidden.

| Improve this Doc View Source

RequiresClaim(IHttpServiceBuilder, String, String)

Устанавливает необходимость наличия у пользователя заданного типа утверждения с заданным значением.

Declaration
public static void RequiresClaim(this IHttpServiceBuilder target, string claimType, string claimValue)
Parameters
Type Name Description
IHttpServiceBuilder target
System.String claimType
System.String claimValue
Remarks

Если пользователь не идентифицирован, клиенту будет возвращен ответ Unauthorized. Если пользователь не имеет утверждения заданного типа с заданным значением, клиенту будет возвращен ответ Forbidden.

| Improve this Doc View Source

RequiresValidUser(IHttpServiceBuilder, Func<IIdentity, Boolean>)

Устанавливает необходимость наличия пользователя, который проходит заданную проверку.

Declaration
public static void RequiresValidUser(this IHttpServiceBuilder target, Func<IIdentity, bool> userMatch)
Parameters
Type Name Description
IHttpServiceBuilder target
Func<IIdentity, System.Boolean> userMatch
Remarks

Если пользователь не идентифицирован, клиенту будет возвращен ответ Unauthorized. Если пользователь не проходит заданную проверку, клиенту будет возвращен ответ Forbidden.

| Improve this Doc View Source

SetClaim(IIdentity, String, String)

Заменяет все утверждения заданного типа.

Declaration
public static void SetClaim(this IIdentity identity, string claimType, string claimValue)
Parameters
Type Name Description
IIdentity identity

Объект идентификации.

System.String claimType

Тип утверждения (например, ).

System.String claimValue

Значение утверждения.

  • Improve this Doc
  • View Source
Back to top © Copyright Infinnity Solutions Ltd, 2010–2017.