review comments

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-02-10 10:36:45 +01:00
parent bf5222bfa1
commit 3c9aed1b16
9 changed files with 69 additions and 26 deletions
-3
View File
@@ -128,9 +128,6 @@ export type AwsAlbProviderOptions = {
};
};
// @public @deprecated
export type BackstageIdentity = BackstageSignInResult;
// Warning: (ae-missing-release-tag) "BitbucketOAuthResult" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
+1 -1
View File
@@ -48,6 +48,6 @@ export type {
// These types are needed for a postMessage from the login pop-up
// to the frontend
export type { AuthResponse, BackstageIdentity, ProfileInfo } from './types';
export type { AuthResponse, ProfileInfo } from './types';
export { prepareBackstageIdentityResponse } from './prepareBackstageIdentityResponse';
@@ -164,14 +164,6 @@ export type AuthResponse<ProviderInfo> = {
backstageIdentity?: BackstageIdentityResponse;
};
/**
* The old exported symbol for {@link @backstage/plugin-auth-node#BackstageSignInResult}.
*
* @public
* @deprecated Use the {@link @backstage/plugin-auth-node#BackstageSignInResult} instead.
*/
export type BackstageIdentity = BackstageSignInResult;
/**
* Used to display login information to user, i.e. sidebar popup.
*
+4 -1
View File
@@ -34,7 +34,10 @@ export function getBearerTokenFromAuthorizationHeader(
// @public
export class IdentityClient {
constructor(options: { discovery: PluginEndpointDiscovery; issuer: string });
authenticate(token: string | undefined): Promise<BackstageIdentityResponse>;
static create(options: {
discovery: PluginEndpointDiscovery;
issuer: string;
}): IdentityClient;
}
```
+1 -1
View File
@@ -98,7 +98,7 @@ describe('IdentityClient', () => {
afterEach(() => server.resetHandlers());
beforeEach(() => {
client = new IdentityClient({ discovery, issuer: mockBaseUrl });
client = IdentityClient.create({ discovery, issuer: mockBaseUrl });
factory = new FakeTokenFactory({
issuer: mockBaseUrl,
keyDurationSeconds,
+14 -1
View File
@@ -35,7 +35,20 @@ export class IdentityClient {
private keyStore: JWKS.KeyStore;
private keyStoreUpdated: number;
constructor(options: { discovery: PluginEndpointDiscovery; issuer: string }) {
/**
* Create a new {@link IdentityClient} instance.
*/
static create(options: {
discovery: PluginEndpointDiscovery;
issuer: string;
}): IdentityClient {
return new IdentityClient(options);
}
private constructor(options: {
discovery: PluginEndpointDiscovery;
issuer: string;
}) {
this.discovery = options.discovery;
this.issuer = options.issuer;
this.keyStore = new JWKS.KeyStore();