ScmAuth
Home > @backstage/integration-react
> ScmAuth
An implementation of the ScmAuthApi that merges together OAuthApi instances to form a single instance that can handles authentication for multiple providers.
Signature:
class ScmAuth implements ScmAuthApi
Implements: ScmAuthApi
Example
// Supports authentication towards both public GitHub and GHE:
createApiFactory({
api: scmAuthApiRef,
deps: {
gheAuthApi: gheAuthApiRef,
githubAuthApi: githubAuthApiRef,
},
factory: ({ githubAuthApi, gheAuthApi }) =>
ScmAuth.merge(
ScmAuth.forGithub(githubAuthApi),
ScmAuth.forGithub(gheAuthApi, {
host: 'ghe.example.com',
}),
)
})
Methods
Method |
Modifiers |
Description |
---|---|---|
|
Creates an API factory that enables auth for each of the default SCM providers. | |
|
Creates a general purpose ScmAuth instance with a custom scope mapping. | |
|
Creates a new ScmAuth instance that handles authentication towards Azure. The host option determines which URLs that are handled by this instance and defaults to The default scopes are:
If the additional
| |
|
Creates a new ScmAuth instance that handles authentication towards Bitbucket. The host option determines which URLs that are handled by this instance and defaults to The default scopes are:
If the additional
| |
|
Creates a new ScmAuth instance that handles authentication towards Bitbucket Server. The host option determines which URLs that are handled by this instance. The default scopes are:
If the additional
| |
|
Creates a new ScmAuth instance that handles authentication towards GitHub. The host option determines which URLs that are handled by this instance and defaults to The default scopes are:
If the additional
| |
|
Creates a new ScmAuth instance that handles authentication towards GitLab. The host option determines which URLs that are handled by this instance and defaults to The default scopes are:
If the additional
| |
Fetches credentials for the given resource. | ||
Checks whether the implementation is able to provide authentication for the given URL. | ||
|
Merges together multiple ScmAuth instances into one that routes requests to the correct instance based on the URL. |