mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 03:06:31 -05:00
refactor: remove dropbox, facebook & twitter login
Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
29bf32b76f
commit
d43da06ec1
15 changed files with 19 additions and 207 deletions
|
@ -6,6 +6,14 @@ SPDX-License-Identifier: CC-BY-SA-4.0
|
||||||
|
|
||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Removals
|
||||||
|
|
||||||
|
- Dropbox Login
|
||||||
|
- Facebook Login
|
||||||
|
- Twitter Login
|
||||||
|
|
||||||
Please refer to the release notes published on
|
Please refer to the release notes published on
|
||||||
[our releases page](https://hedgedoc.org/releases/) or [on GitHub](https://github.com/hedgedoc/hedgedoc/releases).
|
[our releases page](https://hedgedoc.org/releases/) or [on GitHub](https://github.com/hedgedoc/hedgedoc/releases).
|
||||||
|
|
||||||
|
|
|
@ -40,23 +40,10 @@ export interface AuthConfig {
|
||||||
enableRegister: boolean;
|
enableRegister: boolean;
|
||||||
minimalPasswordStrength: number;
|
minimalPasswordStrength: number;
|
||||||
};
|
};
|
||||||
facebook: {
|
|
||||||
clientID: string;
|
|
||||||
clientSecret: string;
|
|
||||||
};
|
|
||||||
twitter: {
|
|
||||||
consumerKey: string;
|
|
||||||
consumerSecret: string;
|
|
||||||
};
|
|
||||||
github: {
|
github: {
|
||||||
clientID: string;
|
clientID: string;
|
||||||
clientSecret: string;
|
clientSecret: string;
|
||||||
};
|
};
|
||||||
dropbox: {
|
|
||||||
clientID: string;
|
|
||||||
clientSecret: string;
|
|
||||||
appKey: string;
|
|
||||||
};
|
|
||||||
google: {
|
google: {
|
||||||
clientID: string;
|
clientID: string;
|
||||||
clientSecret: string;
|
clientSecret: string;
|
||||||
|
@ -134,29 +121,10 @@ const authSchema = Joi.object({
|
||||||
.optional()
|
.optional()
|
||||||
.label('HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH'),
|
.label('HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH'),
|
||||||
},
|
},
|
||||||
facebook: {
|
|
||||||
clientID: Joi.string().optional().label('HD_AUTH_FACEBOOK_CLIENT_ID'),
|
|
||||||
clientSecret: Joi.string()
|
|
||||||
.optional()
|
|
||||||
.label('HD_AUTH_FACEBOOK_CLIENT_SECRET'),
|
|
||||||
},
|
|
||||||
twitter: {
|
|
||||||
consumerKey: Joi.string().optional().label('HD_AUTH_TWITTER_CONSUMER_KEY'),
|
|
||||||
consumerSecret: Joi.string()
|
|
||||||
.optional()
|
|
||||||
.label('HD_AUTH_TWITTER_CONSUMER_SECRET'),
|
|
||||||
},
|
|
||||||
github: {
|
github: {
|
||||||
clientID: Joi.string().optional().label('HD_AUTH_GITHUB_CLIENT_ID'),
|
clientID: Joi.string().optional().label('HD_AUTH_GITHUB_CLIENT_ID'),
|
||||||
clientSecret: Joi.string().optional().label('HD_AUTH_GITHUB_CLIENT_SECRET'),
|
clientSecret: Joi.string().optional().label('HD_AUTH_GITHUB_CLIENT_SECRET'),
|
||||||
},
|
},
|
||||||
dropbox: {
|
|
||||||
clientID: Joi.string().optional().label('HD_AUTH_DROPBOX_CLIENT_ID'),
|
|
||||||
clientSecret: Joi.string()
|
|
||||||
.optional()
|
|
||||||
.label('HD_AUTH_DROPBOX_CLIENT_SECRET'),
|
|
||||||
appKey: Joi.string().optional().label('HD_AUTH_DROPBOX_APP_KEY'),
|
|
||||||
},
|
|
||||||
google: {
|
google: {
|
||||||
clientID: Joi.string().optional().label('HD_AUTH_GOOGLE_CLIENT_ID'),
|
clientID: Joi.string().optional().label('HD_AUTH_GOOGLE_CLIENT_ID'),
|
||||||
clientSecret: Joi.string().optional().label('HD_AUTH_GOOGLE_CLIENT_SECRET'),
|
clientSecret: Joi.string().optional().label('HD_AUTH_GOOGLE_CLIENT_SECRET'),
|
||||||
|
@ -379,23 +347,10 @@ export default registerAs('authConfig', () => {
|
||||||
process.env.HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH,
|
process.env.HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
facebook: {
|
|
||||||
clientID: process.env.HD_AUTH_FACEBOOK_CLIENT_ID,
|
|
||||||
clientSecret: process.env.HD_AUTH_FACEBOOK_CLIENT_SECRET,
|
|
||||||
},
|
|
||||||
twitter: {
|
|
||||||
consumerKey: process.env.HD_AUTH_TWITTER_CONSUMER_KEY,
|
|
||||||
consumerSecret: process.env.HD_AUTH_TWITTER_CONSUMER_SECRET,
|
|
||||||
},
|
|
||||||
github: {
|
github: {
|
||||||
clientID: process.env.HD_AUTH_GITHUB_CLIENT_ID,
|
clientID: process.env.HD_AUTH_GITHUB_CLIENT_ID,
|
||||||
clientSecret: process.env.HD_AUTH_GITHUB_CLIENT_SECRET,
|
clientSecret: process.env.HD_AUTH_GITHUB_CLIENT_SECRET,
|
||||||
},
|
},
|
||||||
dropbox: {
|
|
||||||
clientID: process.env.HD_AUTH_DROPBOX_CLIENT_ID,
|
|
||||||
clientSecret: process.env.HD_AUTH_DROPBOX_CLIENT_SECRET,
|
|
||||||
appKey: process.env.HD_AUTH_DROPBOX_APP_KEY,
|
|
||||||
},
|
|
||||||
google: {
|
google: {
|
||||||
clientID: process.env.HD_AUTH_GOOGLE_CLIENT_ID,
|
clientID: process.env.HD_AUTH_GOOGLE_CLIENT_ID,
|
||||||
clientSecret: process.env.HD_AUTH_GOOGLE_CLIENT_SECRET,
|
clientSecret: process.env.HD_AUTH_GOOGLE_CLIENT_SECRET,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
@ -19,23 +19,10 @@ export function createDefaultMockAuthConfig(): AuthConfig {
|
||||||
enableRegister: true,
|
enableRegister: true,
|
||||||
minimalPasswordStrength: 2,
|
minimalPasswordStrength: 2,
|
||||||
},
|
},
|
||||||
facebook: {
|
|
||||||
clientID: '',
|
|
||||||
clientSecret: '',
|
|
||||||
},
|
|
||||||
twitter: {
|
|
||||||
consumerKey: '',
|
|
||||||
consumerSecret: '',
|
|
||||||
},
|
|
||||||
github: {
|
github: {
|
||||||
clientID: '',
|
clientID: '',
|
||||||
clientSecret: '',
|
clientSecret: '',
|
||||||
},
|
},
|
||||||
dropbox: {
|
|
||||||
clientID: '',
|
|
||||||
clientSecret: '',
|
|
||||||
appKey: '',
|
|
||||||
},
|
|
||||||
google: {
|
google: {
|
||||||
clientID: '',
|
clientID: '',
|
||||||
clientSecret: '',
|
clientSecret: '',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
@ -25,10 +25,7 @@ export enum AuthProviderType {
|
||||||
SAML = 'saml',
|
SAML = 'saml',
|
||||||
OAUTH2 = 'oauth2',
|
OAUTH2 = 'oauth2',
|
||||||
GITLAB = 'gitlab',
|
GITLAB = 'gitlab',
|
||||||
FACEBOOK = 'facebook',
|
|
||||||
GITHUB = 'github',
|
GITHUB = 'github',
|
||||||
TWITTER = 'twitter',
|
|
||||||
DROPBOX = 'dropbox',
|
|
||||||
GOOGLE = 'google',
|
GOOGLE = 'google',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,10 +37,7 @@ export type AuthProviderTypeWithCustomName =
|
||||||
|
|
||||||
export type AuthProviderTypeWithoutCustomName =
|
export type AuthProviderTypeWithoutCustomName =
|
||||||
| AuthProviderType.LOCAL
|
| AuthProviderType.LOCAL
|
||||||
| AuthProviderType.FACEBOOK
|
|
||||||
| AuthProviderType.GITHUB
|
| AuthProviderType.GITHUB
|
||||||
| AuthProviderType.TWITTER
|
|
||||||
| AuthProviderType.DROPBOX
|
|
||||||
| AuthProviderType.GOOGLE;
|
| AuthProviderType.GOOGLE;
|
||||||
|
|
||||||
export class AuthProviderWithoutCustomNameDto extends BaseDto {
|
export class AuthProviderWithoutCustomNameDto extends BaseDto {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
@ -37,23 +37,10 @@ describe('FrontendConfigService', () => {
|
||||||
enableRegister: false,
|
enableRegister: false,
|
||||||
minimalPasswordStrength: 2,
|
minimalPasswordStrength: 2,
|
||||||
},
|
},
|
||||||
facebook: {
|
|
||||||
clientID: undefined,
|
|
||||||
clientSecret: undefined,
|
|
||||||
},
|
|
||||||
twitter: {
|
|
||||||
consumerKey: undefined,
|
|
||||||
consumerSecret: undefined,
|
|
||||||
},
|
|
||||||
github: {
|
github: {
|
||||||
clientID: undefined,
|
clientID: undefined,
|
||||||
clientSecret: undefined,
|
clientSecret: undefined,
|
||||||
},
|
},
|
||||||
dropbox: {
|
|
||||||
clientID: undefined,
|
|
||||||
clientSecret: undefined,
|
|
||||||
appKey: undefined,
|
|
||||||
},
|
|
||||||
google: {
|
google: {
|
||||||
clientID: undefined,
|
clientID: undefined,
|
||||||
clientSecret: undefined,
|
clientSecret: undefined,
|
||||||
|
@ -66,23 +53,10 @@ describe('FrontendConfigService', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('getAuthProviders', () => {
|
describe('getAuthProviders', () => {
|
||||||
const facebook: AuthConfig['facebook'] = {
|
|
||||||
clientID: 'facebookTestId',
|
|
||||||
clientSecret: 'facebookTestSecret',
|
|
||||||
};
|
|
||||||
const twitter: AuthConfig['twitter'] = {
|
|
||||||
consumerKey: 'twitterTestId',
|
|
||||||
consumerSecret: 'twitterTestSecret',
|
|
||||||
};
|
|
||||||
const github: AuthConfig['github'] = {
|
const github: AuthConfig['github'] = {
|
||||||
clientID: 'githubTestId',
|
clientID: 'githubTestId',
|
||||||
clientSecret: 'githubTestSecret',
|
clientSecret: 'githubTestSecret',
|
||||||
};
|
};
|
||||||
const dropbox: AuthConfig['dropbox'] = {
|
|
||||||
clientID: 'dropboxTestId',
|
|
||||||
clientSecret: 'dropboxTestSecret',
|
|
||||||
appKey: 'dropboxTestKey',
|
|
||||||
};
|
|
||||||
const google: AuthConfig['google'] = {
|
const google: AuthConfig['google'] = {
|
||||||
clientID: 'googleTestId',
|
clientID: 'googleTestId',
|
||||||
clientSecret: 'googleTestSecret',
|
clientSecret: 'googleTestSecret',
|
||||||
|
@ -155,10 +129,7 @@ describe('FrontendConfigService', () => {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
for (const authConfigConfigured of [
|
for (const authConfigConfigured of [
|
||||||
facebook,
|
|
||||||
twitter,
|
|
||||||
github,
|
github,
|
||||||
dropbox,
|
|
||||||
google,
|
google,
|
||||||
gitlab,
|
gitlab,
|
||||||
ldap,
|
ldap,
|
||||||
|
@ -211,16 +182,6 @@ describe('FrontendConfigService', () => {
|
||||||
}).compile();
|
}).compile();
|
||||||
const service = module.get(FrontendConfigService);
|
const service = module.get(FrontendConfigService);
|
||||||
const config = await service.getFrontendConfig();
|
const config = await service.getFrontendConfig();
|
||||||
if (authConfig.dropbox.clientID) {
|
|
||||||
expect(config.authProviders).toContainEqual({
|
|
||||||
type: AuthProviderType.DROPBOX,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (authConfig.facebook.clientID) {
|
|
||||||
expect(config.authProviders).toContainEqual({
|
|
||||||
type: AuthProviderType.FACEBOOK,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (authConfig.google.clientID) {
|
if (authConfig.google.clientID) {
|
||||||
expect(config.authProviders).toContainEqual({
|
expect(config.authProviders).toContainEqual({
|
||||||
type: AuthProviderType.GOOGLE,
|
type: AuthProviderType.GOOGLE,
|
||||||
|
@ -236,11 +197,6 @@ describe('FrontendConfigService', () => {
|
||||||
type: AuthProviderType.LOCAL,
|
type: AuthProviderType.LOCAL,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (authConfig.twitter.consumerKey) {
|
|
||||||
expect(config.authProviders).toContainEqual({
|
|
||||||
type: AuthProviderType.TWITTER,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
expect(
|
expect(
|
||||||
config.authProviders.filter(
|
config.authProviders.filter(
|
||||||
(provider) => provider.type === AuthProviderType.GITLAB,
|
(provider) => provider.type === AuthProviderType.GITLAB,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
@ -66,16 +66,6 @@ export class FrontendConfigService {
|
||||||
type: AuthProviderType.LOCAL,
|
type: AuthProviderType.LOCAL,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this.authConfig.dropbox.clientID) {
|
|
||||||
providers.push({
|
|
||||||
type: AuthProviderType.DROPBOX,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (this.authConfig.facebook.clientID) {
|
|
||||||
providers.push({
|
|
||||||
type: AuthProviderType.FACEBOOK,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (this.authConfig.github.clientID) {
|
if (this.authConfig.github.clientID) {
|
||||||
providers.push({
|
providers.push({
|
||||||
type: AuthProviderType.GITHUB,
|
type: AuthProviderType.GITHUB,
|
||||||
|
@ -86,11 +76,6 @@ export class FrontendConfigService {
|
||||||
type: AuthProviderType.GOOGLE,
|
type: AuthProviderType.GOOGLE,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this.authConfig.twitter.consumerKey) {
|
|
||||||
providers.push({
|
|
||||||
type: AuthProviderType.TWITTER,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.authConfig.gitlab.forEach((gitLabEntry) => {
|
this.authConfig.gitlab.forEach((gitLabEntry) => {
|
||||||
providers.push({
|
providers.push({
|
||||||
type: AuthProviderType.GITLAB,
|
type: AuthProviderType.GITLAB,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
@ -18,7 +18,7 @@ import { ProviderType } from './provider-type.enum';
|
||||||
/**
|
/**
|
||||||
* The identity represents a single way for a user to login.
|
* The identity represents a single way for a user to login.
|
||||||
* A 'user' can have any number of these.
|
* A 'user' can have any number of these.
|
||||||
* Each one holds a type (local, github, twitter, etc.), if this type can have multiple instances (e.g. gitlab),
|
* Each one holds a type (local, github, etc.), if this type can have multiple instances (e.g. gitlab),
|
||||||
* it also saves the name of the instance. Also if this identity shall be the syncSource is saved.
|
* it also saves the name of the instance. Also if this identity shall be the syncSource is saved.
|
||||||
*/
|
*/
|
||||||
@Entity()
|
@Entity()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
@ -11,8 +11,5 @@ export enum ProviderType {
|
||||||
OAUTH2 = 'oauth2',
|
OAUTH2 = 'oauth2',
|
||||||
GITLAB = 'gitlab',
|
GITLAB = 'gitlab',
|
||||||
GITHUB = 'github',
|
GITHUB = 'github',
|
||||||
FACEBOOK = 'facebook',
|
|
||||||
TWITTER = 'twitter',
|
|
||||||
DROPBOX = 'dropbox',
|
|
||||||
GOOGLE = 'google',
|
GOOGLE = 'google',
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,9 +52,6 @@ using one of the supported authentication methods:
|
||||||
- OAuth2
|
- OAuth2
|
||||||
- GitLab
|
- GitLab
|
||||||
- GitHub
|
- GitHub
|
||||||
- Facebook
|
|
||||||
- Twitter
|
|
||||||
- Dropbox
|
|
||||||
- Google
|
- Google
|
||||||
|
|
||||||
The `SessionGuard`, which is added to each (appropriate) controller method of the private API,
|
The `SessionGuard`, which is added to each (appropriate) controller method of the private API,
|
||||||
|
|
|
@ -54,10 +54,6 @@
|
||||||
max-width: 1440px;
|
max-width: 1440px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.twitter {
|
|
||||||
color: #1DA1F2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mastodon {
|
.mastodon {
|
||||||
color: #2b90d9;
|
color: #2b90d9;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,18 +20,9 @@ export const branding = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const authProviders = [
|
export const authProviders = [
|
||||||
{
|
|
||||||
type: AuthProviderType.FACEBOOK
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: AuthProviderType.GITHUB
|
type: AuthProviderType.GITHUB
|
||||||
},
|
},
|
||||||
{
|
|
||||||
type: AuthProviderType.TWITTER
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: AuthProviderType.DROPBOX
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: AuthProviderType.GOOGLE
|
type: AuthProviderType.GOOGLE
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,11 +24,8 @@ export enum GuestAccessLevel {
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum AuthProviderType {
|
export enum AuthProviderType {
|
||||||
DROPBOX = 'dropbox',
|
|
||||||
FACEBOOK = 'facebook',
|
|
||||||
GITHUB = 'github',
|
GITHUB = 'github',
|
||||||
GOOGLE = 'google',
|
GOOGLE = 'google',
|
||||||
TWITTER = 'twitter',
|
|
||||||
GITLAB = 'gitlab',
|
GITLAB = 'gitlab',
|
||||||
OAUTH2 = 'oauth2',
|
OAUTH2 = 'oauth2',
|
||||||
LDAP = 'ldap',
|
LDAP = 'ldap',
|
||||||
|
@ -43,22 +40,16 @@ export type AuthProviderTypeWithCustomName =
|
||||||
| AuthProviderType.SAML
|
| AuthProviderType.SAML
|
||||||
|
|
||||||
export type AuthProviderTypeWithoutCustomName =
|
export type AuthProviderTypeWithoutCustomName =
|
||||||
| AuthProviderType.DROPBOX
|
|
||||||
| AuthProviderType.FACEBOOK
|
|
||||||
| AuthProviderType.GITHUB
|
| AuthProviderType.GITHUB
|
||||||
| AuthProviderType.GOOGLE
|
| AuthProviderType.GOOGLE
|
||||||
| AuthProviderType.TWITTER
|
|
||||||
| AuthProviderType.LOCAL
|
| AuthProviderType.LOCAL
|
||||||
|
|
||||||
export const authProviderTypeOneClick = [
|
export const authProviderTypeOneClick = [
|
||||||
AuthProviderType.DROPBOX,
|
|
||||||
AuthProviderType.FACEBOOK,
|
|
||||||
AuthProviderType.GITHUB,
|
AuthProviderType.GITHUB,
|
||||||
AuthProviderType.GITLAB,
|
AuthProviderType.GITLAB,
|
||||||
AuthProviderType.GOOGLE,
|
AuthProviderType.GOOGLE,
|
||||||
AuthProviderType.OAUTH2,
|
AuthProviderType.OAUTH2,
|
||||||
AuthProviderType.SAML,
|
AuthProviderType.SAML
|
||||||
AuthProviderType.TWITTER
|
|
||||||
]
|
]
|
||||||
|
|
||||||
export interface AuthProviderWithCustomName {
|
export interface AuthProviderWithCustomName {
|
||||||
|
|
|
@ -6,14 +6,11 @@
|
||||||
import styles from './via-one-click.module.scss'
|
import styles from './via-one-click.module.scss'
|
||||||
import type { Icon } from 'react-bootstrap-icons'
|
import type { Icon } from 'react-bootstrap-icons'
|
||||||
import {
|
import {
|
||||||
Dropbox as IconDropbox,
|
|
||||||
Exclamation as IconExclamation,
|
Exclamation as IconExclamation,
|
||||||
Facebook as IconFacebook,
|
|
||||||
Github as IconGithub,
|
Github as IconGithub,
|
||||||
Google as IconGoogle,
|
Google as IconGoogle,
|
||||||
People as IconPeople,
|
People as IconPeople,
|
||||||
PersonRolodex as IconPersonRolodex,
|
PersonRolodex as IconPersonRolodex
|
||||||
Twitter as IconTwitter
|
|
||||||
} from 'react-bootstrap-icons'
|
} from 'react-bootstrap-icons'
|
||||||
import { Logger } from '../../../utils/logger'
|
import { Logger } from '../../../utils/logger'
|
||||||
import type { AuthProvider } from '../../../api/config/types'
|
import type { AuthProvider } from '../../../api/config/types'
|
||||||
|
@ -41,20 +38,6 @@ const logger = new Logger('GetOneClickProviderMetadata')
|
||||||
*/
|
*/
|
||||||
export const getOneClickProviderMetadata = (provider: AuthProvider): OneClickMetadata => {
|
export const getOneClickProviderMetadata = (provider: AuthProvider): OneClickMetadata => {
|
||||||
switch (provider.type) {
|
switch (provider.type) {
|
||||||
case AuthProviderType.DROPBOX:
|
|
||||||
return {
|
|
||||||
name: 'Dropbox',
|
|
||||||
icon: IconDropbox,
|
|
||||||
className: styles['btn-social-dropbox'],
|
|
||||||
url: getBackendAuthUrl('dropbox')
|
|
||||||
}
|
|
||||||
case AuthProviderType.FACEBOOK:
|
|
||||||
return {
|
|
||||||
name: 'Facebook',
|
|
||||||
icon: IconFacebook,
|
|
||||||
className: styles['btn-social-facebook'],
|
|
||||||
url: getBackendAuthUrl('facebook')
|
|
||||||
}
|
|
||||||
case AuthProviderType.GITHUB:
|
case AuthProviderType.GITHUB:
|
||||||
return {
|
return {
|
||||||
name: 'GitHub',
|
name: 'GitHub',
|
||||||
|
@ -90,13 +73,6 @@ export const getOneClickProviderMetadata = (provider: AuthProvider): OneClickMet
|
||||||
className: 'btn-success',
|
className: 'btn-success',
|
||||||
url: getBackendAuthUrl(provider.identifier)
|
url: getBackendAuthUrl(provider.identifier)
|
||||||
}
|
}
|
||||||
case AuthProviderType.TWITTER:
|
|
||||||
return {
|
|
||||||
name: 'Twitter',
|
|
||||||
icon: IconTwitter,
|
|
||||||
className: styles['btn-social-twitter'],
|
|
||||||
url: getBackendAuthUrl('twitter')
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
logger.warn('Metadata for one-click-provider does not exist', provider)
|
logger.warn('Metadata for one-click-provider does not exist', provider)
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*!
|
||||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
@ -12,14 +12,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-social-dropbox {
|
|
||||||
@include button(#1087DD);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-social-facebook {
|
|
||||||
@include button(#3B5998);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-social-github {
|
.btn-social-github {
|
||||||
@include button(#444444);
|
@include button(#444444);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +23,3 @@
|
||||||
.btn-social-google {
|
.btn-social-google {
|
||||||
@include button(#DD4B39);
|
@include button(#DD4B39);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-social-twitter {
|
|
||||||
@include button(#55ACEE);
|
|
||||||
}
|
|
||||||
|
|
|
@ -39,18 +39,9 @@ const initialConfig: FrontendConfig = {
|
||||||
{
|
{
|
||||||
type: AuthProviderType.LOCAL
|
type: AuthProviderType.LOCAL
|
||||||
},
|
},
|
||||||
{
|
|
||||||
type: AuthProviderType.FACEBOOK
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: AuthProviderType.GITHUB
|
type: AuthProviderType.GITHUB
|
||||||
},
|
},
|
||||||
{
|
|
||||||
type: AuthProviderType.TWITTER
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: AuthProviderType.DROPBOX
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: AuthProviderType.GOOGLE
|
type: AuthProviderType.GOOGLE
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue