Bump swift-actions/setup-swift from 1.22.0 to 1.23.0
Bumps swift-actions/setup-swift from 1.22.0 to 1.23.0.
updated-dependencies:
- dependency-name: swift-actions/setup-swift dependency-type: direct:production update-type: version-update:semver-minor …
Signed-off-by: dependabot[bot] support@github.com
AuthScope
Handle authentication scopes with ease.
Installation
Swift Package Manager
Add the following package dependency to your
Package.swift
:Usage
The main object you want to use is
Scope<AccessRange>
. It’s generic and wraps all the logic around a givenAccessRange
type. SinceScope
can’t know what access ranges you have, you need to provide them yourself. Typically, this is done by using anenum
and conforming it toAccessRangeProtocol
:You can then use your
enum
withScope
:Scope
conforms toSetAlgebra
to make checking access ranges easier:Scope
is also able to generate a “scope string”, since this is usually how they’re provided to APIs. The “scope string” contains all access ranges (theirrawValue
to be exact) separated by space. It’s important to note thatScope
does not keep the access ranges in a given order. This means, that it’s not guaranteed that two calls toscopeString
will contain the access ranges in the same order. It is guaranteed, however, that the resulting scope contains all access ranges.Scope
can of course also be created from a scope string. This initializer will throw an error if any of the contained access ranges is not valid.Scope
is alsoCodable
and encodes/decodes itself as its scope string.Last but not least, Scope also provides some useful regular expression patterns, that can be used to perform matches on a string basis. This is not recommended if your scopes are available as Swift types, but can be useful if you have to match scopes e.g. in a database. There are currently three regular expression patterns that are provided:
exactMatchRegExp
: Returns a pattern that matches a scope string that contains exactly the same access ranges. Not more and not less.containsAllRegExp
: Returns a pattern that matches a scope string that contains all access ranges, but is allowed to contain more.containsAnyRegExp
: Returns a pattern that matches a scope string that contains any access ranges. A match is made as soon as one access range is contained.Documentation
The API is documented using header doc. If you prefer to view the documentation as a webpage, there is an online version available for you.
Contributing
If you find a bug / like to see a new feature in AuthScope there are a few ways of helping out:
License
See LICENSE file.