C# Class Disco.Services.Authorization.AuthorizationToken

Inheritance: IAuthorizationToken
Show file Open project: garysharp/Disco Class Usage Examples

Public Methods

Method Description
BuildComputerAccountToken ( User User ) : AuthorizationToken
BuildToken ( User User, IEnumerable GroupMembership ) : AuthorizationToken
Has ( bool>.Func ClaimAccessor ) : bool

Checks if token contains the claim requested.

Has ( string ClaimKey ) : bool

Checks if token contains the claim requested.

HasAll ( ) : bool

Checks if token contains all the claims requested.

HasAll ( IEnumerable ClaimKeys ) : bool

Checks if token contains all the claims requested.

HasAny ( ) : bool

Checks if token contains at least one of the claims requested.

HasAny ( IEnumerable ClaimKeys ) : bool

Checks if token contains at least one of the claims requested.

Require ( string ClaimKey ) : void

Validates the token contains the claim required. An Disco.Services.Authorization.AccessDeniedException is thrown if the requirements are not met.

RequireAll ( ) : void

Validates the token contains all the claims required. An Disco.Services.Authorization.AccessDeniedException is thrown if the requirements are not met.

RequireAny ( ) : void

Validates the token contains at least one of the claims required. An Disco.Services.Authorization.AccessDeniedException is thrown if the requirements are not met.

Private Methods

Method Description
BuildRequireAllMessage ( IEnumerable ClaimKeys ) : string
BuildRequireAnyMessage ( IEnumerable ClaimKeys ) : string
BuildRequireMessage ( string ClaimKey ) : string
GetRequireResource ( ) : string

Method Details

BuildComputerAccountToken() public static method

public static BuildComputerAccountToken ( User User ) : AuthorizationToken
User Disco.Models.Repository.User
return AuthorizationToken

BuildToken() public static method

public static BuildToken ( User User, IEnumerable GroupMembership ) : AuthorizationToken
User Disco.Models.Repository.User
GroupMembership IEnumerable
return AuthorizationToken

Has() public method

Checks if token contains the claim requested.
public Has ( bool>.Func ClaimAccessor ) : bool
ClaimAccessor bool>.Func A lambda which validates the tokens
return bool

Has() public method

Checks if token contains the claim requested.
public Has ( string ClaimKey ) : bool
ClaimKey string Claim Key from
return bool

HasAll() public method

Checks if token contains all the claims requested.
public HasAll ( ) : bool
return bool

HasAll() public method

Checks if token contains all the claims requested.
public HasAll ( IEnumerable ClaimKeys ) : bool
ClaimKeys IEnumerable Claim Keys from
return bool

HasAny() public method

Checks if token contains at least one of the claims requested.
public HasAny ( ) : bool
return bool

HasAny() public method

Checks if token contains at least one of the claims requested.
public HasAny ( IEnumerable ClaimKeys ) : bool
ClaimKeys IEnumerable Claim Keys from
return bool

Require() public method

Validates the token contains the claim required. An Disco.Services.Authorization.AccessDeniedException is thrown if the requirements are not met.
public Require ( string ClaimKey ) : void
ClaimKey string Claim Key from
return void

RequireAll() public method

Validates the token contains all the claims required. An Disco.Services.Authorization.AccessDeniedException is thrown if the requirements are not met.
public RequireAll ( ) : void
return void

RequireAny() public method

Validates the token contains at least one of the claims required. An Disco.Services.Authorization.AccessDeniedException is thrown if the requirements are not met.
public RequireAny ( ) : void
return void