Remove getAccessToken func
This commit is contained in:
+2
-3
@@ -160,9 +160,8 @@ auth:
|
||||
$secret:
|
||||
env: GITLAB_BASE_URL
|
||||
saml:
|
||||
development:
|
||||
entryPoint: 'http://localhost:7001/'
|
||||
issuer: 'passport-saml'
|
||||
entryPoint: 'http://localhost:7001/'
|
||||
issuer: 'passport-saml'
|
||||
okta:
|
||||
development:
|
||||
clientId:
|
||||
|
||||
@@ -101,16 +101,12 @@ export type OAuthApi = {
|
||||
* This API provides access to SAML 2 credentials. Verify user access with identity provider.
|
||||
*/
|
||||
export type SamlApi = {
|
||||
// Not sure what Promise call back should have.
|
||||
getBackstageIdentity(
|
||||
options?: AuthRequestOptions,
|
||||
): Promise<BackstageIdentity | undefined>;
|
||||
|
||||
getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;
|
||||
|
||||
// FIXME: is this needed?
|
||||
getAccessToken(options?: AuthRequestOptions): Promise<string>;
|
||||
|
||||
// Not sure if this is needed.
|
||||
logout(): Promise<void>;
|
||||
};
|
||||
|
||||
@@ -92,12 +92,6 @@ class SamlAuth implements SamlApi {
|
||||
return session?.profile;
|
||||
}
|
||||
|
||||
// FIXME: Is this needed?...
|
||||
async getAccessToken(options: AuthRequestOptions) {
|
||||
const session = await this.sessionManager.getSession(options);
|
||||
return session?.userId ?? '';
|
||||
}
|
||||
|
||||
async logout() {
|
||||
await this.sessionManager.removeSession();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import {
|
||||
BackstageIdentity,
|
||||
DiscoveryApi,
|
||||
} from '../../apis/definitions';
|
||||
import { AuthConnector } from './types';
|
||||
import { showLoginPopup } from '../loginPopup';
|
||||
|
||||
type Options = {
|
||||
@@ -34,8 +33,7 @@ export type SamlResponse = {
|
||||
backstageIdentity: BackstageIdentity;
|
||||
};
|
||||
|
||||
export class SamlAuthConnector<SamlResponse>
|
||||
implements AuthConnector<SamlResponse> {
|
||||
export class SamlAuthConnector<SamlResponse> {
|
||||
private readonly discoveryApi: DiscoveryApi;
|
||||
private readonly environment: string | undefined;
|
||||
private readonly provider: AuthProvider & { id: string };
|
||||
@@ -52,7 +50,7 @@ export class SamlAuthConnector<SamlResponse>
|
||||
const popupUrl = await this.buildUrl('/start');
|
||||
const payload = await showLoginPopup({
|
||||
url: popupUrl,
|
||||
name: 'SAML Login', // FIXME: change this to provider name? and not hardcode the name
|
||||
name: `${this.provider.title} Login`,
|
||||
origin: new URL(popupUrl).origin,
|
||||
width: 450,
|
||||
height: 730,
|
||||
@@ -64,9 +62,6 @@ export class SamlAuthConnector<SamlResponse>
|
||||
};
|
||||
}
|
||||
|
||||
// FIXME: do we need this for SAML?
|
||||
async refreshSession(): Promise<any> {}
|
||||
|
||||
async removeSession(): Promise<void> {
|
||||
const res = await fetch(await this.buildUrl('/logout'), {
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user