Edit

Share via


ScopeSet class

The ScopeSet class creates a set of scopes. Scopes are case-insensitive, unique values, so the Set object in JS makes the most sense to implement for this class. All scopes are trimmed and converted to lower case strings in intersection and union functions to ensure uniqueness of strings.

Constructors

ScopeSet(string[])

Methods

appendScope(string)

Appends single scope if passed

appendScopes(string[])

Appends multiple scopes if passed

asArray()

Returns the scopes as an array of string values

containsOnlyOIDCScopes()

Check if set of scopes contains only the defaults

containsScope(string)

Check if a given scope is present in this set of scopes.

containsScopeSet(ScopeSet)

Check if a set of scopes is present in this set of scopes.

createSearchScopes(string[])

Creates the set of scopes to search for in cache lookups

fromString(string)

Factory method to create ScopeSet from space-delimited string

getScopeCount()

Returns size of set of scopes.

intersectingScopeSets(ScopeSet)

Check if scopes intersect between this set and another.

printScopes()

Prints scopes into a space-delimited string

printScopesLowerCase()

Prints scopes into a space-delimited lower-case string (used for caching)

removeOIDCScopes()

Removes default scopes from set of scopes Primarily used to prevent cache misses if the default scopes are not returned from the server

removeScope(string)

Removes element from set of scopes.

unionScopeSets(ScopeSet)

Combines an array of scopes with the current set of scopes.

Constructor Details

ScopeSet(string[])

new ScopeSet(inputScopes: string[])

Parameters

inputScopes

string[]

Method Details

appendScope(string)

Appends single scope if passed

function appendScope(newScope: string)

Parameters

newScope

string

appendScopes(string[])

Appends multiple scopes if passed

function appendScopes(newScopes: string[])

Parameters

newScopes

string[]

asArray()

Returns the scopes as an array of string values

function asArray(): string[]

Returns

string[]

containsOnlyOIDCScopes()

Check if set of scopes contains only the defaults

function containsOnlyOIDCScopes(): boolean

Returns

boolean

containsScope(string)

Check if a given scope is present in this set of scopes.

function containsScope(scope: string): boolean

Parameters

scope

string

Returns

boolean

containsScopeSet(ScopeSet)

Check if a set of scopes is present in this set of scopes.

function containsScopeSet(scopeSet: ScopeSet): boolean

Parameters

scopeSet
ScopeSet

Returns

boolean

createSearchScopes(string[])

Creates the set of scopes to search for in cache lookups

static function createSearchScopes(inputScopeString: string[]): ScopeSet

Parameters

inputScopeString

string[]

Returns

fromString(string)

Factory method to create ScopeSet from space-delimited string

static function fromString(inputScopeString: string): ScopeSet

Parameters

inputScopeString

string

Returns

getScopeCount()

Returns size of set of scopes.

function getScopeCount(): number

Returns

number

intersectingScopeSets(ScopeSet)

Check if scopes intersect between this set and another.

function intersectingScopeSets(otherScopes: ScopeSet): boolean

Parameters

otherScopes
ScopeSet

Returns

boolean

printScopes()

Prints scopes into a space-delimited string

function printScopes(): string

Returns

string

printScopesLowerCase()

Prints scopes into a space-delimited lower-case string (used for caching)

function printScopesLowerCase(): string

Returns

string

removeOIDCScopes()

Removes default scopes from set of scopes Primarily used to prevent cache misses if the default scopes are not returned from the server

function removeOIDCScopes()

removeScope(string)

Removes element from set of scopes.

function removeScope(scope: string)

Parameters

scope

string

unionScopeSets(ScopeSet)

Combines an array of scopes with the current set of scopes.

function unionScopeSets(otherScopes: ScopeSet): Set<string>

Parameters

otherScopes
ScopeSet

Returns

Set<string>