small fixes

Signed-off-by: Aramis <sennyeyaramis@gmail.com>
Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
This commit is contained in:
Aramis
2024-02-11 12:56:51 -05:00
committed by aramissennyeydd
parent 1c64b2af45
commit 4f4fce91cb
7 changed files with 1 additions and 117 deletions
+1 -4
View File
@@ -400,10 +400,7 @@ auth:
myproxy:
development: {}
guest:
development:
signIn:
resolvers:
- resolver: guestUser
development: {}
costInsights:
engineerCost: 200000
-2
View File
@@ -141,8 +141,6 @@ export default async function createPlugin(
},
},
}),
guest: providers.guest.create(),
},
});
}
-20
View File
@@ -464,26 +464,6 @@ export class GoogleAuth {
static create(options: OAuthApiCreateOptions): typeof googleAuthApiRef.T;
}
// @public
export class GuestAuth
implements ProfileInfoApi, BackstageIdentityApi, SessionApi
{
// (undocumented)
static create(options: AuthApiCreateOptions): GuestAuth;
// (undocumented)
getBackstageIdentity(
options?: AuthRequestOptions,
): Promise<BackstageIdentityResponse | undefined>;
// (undocumented)
getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;
// (undocumented)
sessionState$(): Observable<SessionState>;
// (undocumented)
signIn(): Promise<void>;
// (undocumented)
signOut(): Promise<void>;
}
// @public
export class LocalStorageFeatureFlags implements FeatureFlagsApi {
// (undocumented)
@@ -1,60 +0,0 @@
/*
* Copyright 2024 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DirectAuthConnector } from './DirectAuthConnector';
/**
* Add support for refreshing direct tokens. Used for guest authentication.
*/
export class RefreshingDirectAuthConnector<
DirectAuthResponse,
> extends DirectAuthConnector<DirectAuthResponse> {
/**
* Pulled from DefaultAuthConnector and adapted for use with DirectAuthConnector.
*/
async refreshSession(): Promise<any> {
const res = await fetch(
`${await this.buildUrl('/refresh')}&optional=true`,
{
headers: {
'x-requested-with': 'XMLHttpRequest',
},
credentials: 'include',
},
).catch(error => {
throw new Error(`Auth refresh request failed, ${error}`);
});
if (!res.ok) {
const error: any = new Error(
`Auth refresh request failed, ${res.statusText}`,
);
error.status = res.status;
throw error;
}
const authInfo = await res.json();
if (authInfo.error) {
const error = new Error(authInfo.error.message);
if (authInfo.error.name) {
error.name = authInfo.error.name;
}
throw error;
}
return authInfo;
}
}
-5
View File
@@ -503,11 +503,6 @@ export const googleAuthApiRef: ApiRef<
SessionApi
>;
// @public
export const guestAuthApiRef: ApiRef<
ProfileInfoApi & BackstageIdentityApi & SessionApi
>;
// @public
export type IconComponent = ComponentType<
| {
@@ -3,20 +3,9 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import type { AuthProviderFactory } from '@backstage/plugin-auth-node';
import { BackendFeature } from '@backstage/backend-plugin-api';
import type { ProfileTransform } from '@backstage/plugin-auth-node';
import type { SignInResolver } from '@backstage/plugin-auth-node';
import { SignInResolverFactory } from '@backstage/plugin-auth-node';
// @public (undocumented)
const authModuleGuestProvider: () => BackendFeature;
export default authModuleGuestProvider;
// @public (undocumented)
export function createGuestAuthProviderFactory(options?: {
profileTransform?: ProfileTransform<{}>;
signInResolver?: SignInResolver<{}>;
signInResolverFactories?: Record<string, SignInResolverFactory<{}, unknown>>;
}): AuthProviderFactory;
```
-15
View File
@@ -644,21 +644,6 @@ export const providers: Readonly<{
) => AuthProviderFactory_2;
resolvers: never;
}>;
guest: Readonly<{
create: (
options?:
| {
authHandler?: AuthHandler<{}> | undefined;
signIn?:
| {
resolver: SignInResolver<{}>;
}
| undefined;
}
| undefined,
) => AuthProviderFactory_2;
resolvers: never;
}>;
}>;
// @public @deprecated (undocumented)