review fixes. i thought about another force update for a moment :D

This commit is contained in:
Raghunandan
2020-06-10 21:22:09 +02:00
parent 7accc4c0c0
commit d1160d0849
6 changed files with 16 additions and 21 deletions
@@ -173,7 +173,7 @@ export enum SessionState {
SignedOut = 'SignedOut',
}
export type ObservableSessionStateApi = {
export type SessionStateApi = {
sessionState$(): Observable<SessionState>;
};
/**
@@ -185,7 +185,7 @@ export type ObservableSessionStateApi = {
* email and expiration information. Do not rely on any other fields, as they might not be present.
*/
export const googleAuthApiRef = createApiRef<
OAuthApi & OpenIdConnectApi & ProfileInfoApi & ObservableSessionStateApi
OAuthApi & OpenIdConnectApi & ProfileInfoApi & SessionStateApi
>({
id: 'core.auth.google',
description: 'Provides authentication towards Google APIs and identities',
@@ -197,9 +197,7 @@ export const googleAuthApiRef = createApiRef<
* See https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/
* for a full list of supported scopes.
*/
export const githubAuthApiRef = createApiRef<
OAuthApi & ObservableSessionStateApi
>({
export const githubAuthApiRef = createApiRef<OAuthApi & SessionStateApi>({
id: 'core.auth.github',
description: 'Provides authentication towards Github APIs',
});
@@ -20,14 +20,14 @@ import { GithubSession } from './types';
import {
OAuthApi,
AccessTokenOptions,
ObservableSessionStateApi,
SessionStateApi,
SessionState,
} from '../../../definitions/auth';
import { OAuthRequestApi, AuthProvider } from '../../../definitions';
import { SessionManager } from '../../../../lib/AuthSessionManager/types';
import { StaticAuthSessionManager } from '../../../../lib/AuthSessionManager';
import { Observable } from '../../../../types';
import { SessionStateTracker } from '../SessionStateTracker';
import { SessionStateTracker } from '../../../../lib/AuthSessionManager/SessionStateTracker';
type CreateOptions = {
// TODO(Rugvip): These two should be grabbed from global config when available, they're not unique to GithubAuth
@@ -53,7 +53,7 @@ const DEFAULT_PROVIDER = {
icon: GithubIcon,
};
class GithubAuth implements OAuthApi, ObservableSessionStateApi {
class GithubAuth implements OAuthApi, SessionStateApi {
static create({
apiOrigin,
basePath,
@@ -25,14 +25,14 @@ import {
ProfileInfoApi,
ProfileInfoOptions,
ProfileInfo,
ObservableSessionStateApi,
SessionStateApi,
SessionState,
} from '../../../definitions/auth';
import { OAuthRequestApi, AuthProvider } from '../../../definitions';
import { SessionManager } from '../../../../lib/AuthSessionManager/types';
import { RefreshingAuthSessionManager } from '../../../../lib/AuthSessionManager';
import { Observable } from '../../../../types';
import { SessionStateTracker } from '../SessionStateTracker';
import { SessionStateTracker } from '../../../../lib/AuthSessionManager/SessionStateTracker';
type CreateOptions = {
// TODO(Rugvip): These two should be grabbed from global config when available, they're not unique to GoogleAuth
@@ -62,11 +62,7 @@ const DEFAULT_PROVIDER = {
const SCOPE_PREFIX = 'https://www.googleapis.com/auth/';
class GoogleAuth
implements
OAuthApi,
OpenIdConnectApi,
ProfileInfoApi,
ObservableSessionStateApi {
implements OAuthApi, OpenIdConnectApi, ProfileInfoApi, SessionStateApi {
static create({
apiOrigin,
basePath,
@@ -148,6 +144,7 @@ class GoogleAuth
async getProfile(options: ProfileInfoOptions = {}) {
const session = await this.sessionManager.getSession(options);
this.sessionStateTracker.setIsSignedId(!!session);
if (!session) {
return undefined;
}
@@ -14,8 +14,8 @@
* limitations under the License.
*/
import { BehaviorSubject } from '../../../lib';
import { SessionState } from '../..';
import { BehaviorSubject } from '..';
import { SessionState } from '../../apis';
export class SessionStateTracker {
private signedIn: boolean = false;
@@ -17,7 +17,7 @@
import {
ApiRef,
OAuthApi,
ObservableSessionStateApi,
SessionStateApi,
useApi,
Subscription,
IconComponent,
@@ -29,7 +29,7 @@ import { ProviderSettingsItem } from './ProviderSettingsItem';
type OAuthProviderSidebarProps = {
title: string;
icon: IconComponent;
apiRef: ApiRef<OAuthApi & ObservableSessionStateApi>;
apiRef: ApiRef<OAuthApi & SessionStateApi>;
};
export const OAuthProviderSettings: FC<OAuthProviderSidebarProps> = ({
@@ -17,7 +17,7 @@
import {
ApiRef,
OpenIdConnectApi,
ObservableSessionStateApi,
SessionStateApi,
useApi,
Subscription,
IconComponent,
@@ -29,7 +29,7 @@ import { ProviderSettingsItem } from './ProviderSettingsItem';
export type OIDCProviderSidebarProps = {
title: string;
icon: IconComponent;
apiRef: ApiRef<OpenIdConnectApi & ObservableSessionStateApi>;
apiRef: ApiRef<OpenIdConnectApi & SessionStateApi>;
};
export const OIDCProviderSettings: FC<OIDCProviderSidebarProps> = ({