mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-21 17:26:29 -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
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Removals
|
||||
|
||||
- Dropbox Login
|
||||
- Facebook Login
|
||||
- Twitter Login
|
||||
|
||||
Please refer to the release notes published on
|
||||
[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;
|
||||
minimalPasswordStrength: number;
|
||||
};
|
||||
facebook: {
|
||||
clientID: string;
|
||||
clientSecret: string;
|
||||
};
|
||||
twitter: {
|
||||
consumerKey: string;
|
||||
consumerSecret: string;
|
||||
};
|
||||
github: {
|
||||
clientID: string;
|
||||
clientSecret: string;
|
||||
};
|
||||
dropbox: {
|
||||
clientID: string;
|
||||
clientSecret: string;
|
||||
appKey: string;
|
||||
};
|
||||
google: {
|
||||
clientID: string;
|
||||
clientSecret: string;
|
||||
|
@ -134,29 +121,10 @@ const authSchema = Joi.object({
|
|||
.optional()
|
||||
.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: {
|
||||
clientID: Joi.string().optional().label('HD_AUTH_GITHUB_CLIENT_ID'),
|
||||
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: {
|
||||
clientID: Joi.string().optional().label('HD_AUTH_GOOGLE_CLIENT_ID'),
|
||||
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,
|
||||
),
|
||||
},
|
||||
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: {
|
||||
clientID: process.env.HD_AUTH_GITHUB_CLIENT_ID,
|
||||
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: {
|
||||
clientID: process.env.HD_AUTH_GOOGLE_CLIENT_ID,
|
||||
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
|
||||
*/
|
||||
|
@ -19,23 +19,10 @@ export function createDefaultMockAuthConfig(): AuthConfig {
|
|||
enableRegister: true,
|
||||
minimalPasswordStrength: 2,
|
||||
},
|
||||
facebook: {
|
||||
clientID: '',
|
||||
clientSecret: '',
|
||||
},
|
||||
twitter: {
|
||||
consumerKey: '',
|
||||
consumerSecret: '',
|
||||
},
|
||||
github: {
|
||||
clientID: '',
|
||||
clientSecret: '',
|
||||
},
|
||||
dropbox: {
|
||||
clientID: '',
|
||||
clientSecret: '',
|
||||
appKey: '',
|
||||
},
|
||||
google: {
|
||||
clientID: '',
|
||||
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
|
||||
*/
|
||||
|
@ -25,10 +25,7 @@ export enum AuthProviderType {
|
|||
SAML = 'saml',
|
||||
OAUTH2 = 'oauth2',
|
||||
GITLAB = 'gitlab',
|
||||
FACEBOOK = 'facebook',
|
||||
GITHUB = 'github',
|
||||
TWITTER = 'twitter',
|
||||
DROPBOX = 'dropbox',
|
||||
GOOGLE = 'google',
|
||||
}
|
||||
|
||||
|
@ -40,10 +37,7 @@ export type AuthProviderTypeWithCustomName =
|
|||
|
||||
export type AuthProviderTypeWithoutCustomName =
|
||||
| AuthProviderType.LOCAL
|
||||
| AuthProviderType.FACEBOOK
|
||||
| AuthProviderType.GITHUB
|
||||
| AuthProviderType.TWITTER
|
||||
| AuthProviderType.DROPBOX
|
||||
| AuthProviderType.GOOGLE;
|
||||
|
||||
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
|
||||
*/
|
||||
|
@ -37,23 +37,10 @@ describe('FrontendConfigService', () => {
|
|||
enableRegister: false,
|
||||
minimalPasswordStrength: 2,
|
||||
},
|
||||
facebook: {
|
||||
clientID: undefined,
|
||||
clientSecret: undefined,
|
||||
},
|
||||
twitter: {
|
||||
consumerKey: undefined,
|
||||
consumerSecret: undefined,
|
||||
},
|
||||
github: {
|
||||
clientID: undefined,
|
||||
clientSecret: undefined,
|
||||
},
|
||||
dropbox: {
|
||||
clientID: undefined,
|
||||
clientSecret: undefined,
|
||||
appKey: undefined,
|
||||
},
|
||||
google: {
|
||||
clientID: undefined,
|
||||
clientSecret: undefined,
|
||||
|
@ -66,23 +53,10 @@ describe('FrontendConfigService', () => {
|
|||
};
|
||||
|
||||
describe('getAuthProviders', () => {
|
||||
const facebook: AuthConfig['facebook'] = {
|
||||
clientID: 'facebookTestId',
|
||||
clientSecret: 'facebookTestSecret',
|
||||
};
|
||||
const twitter: AuthConfig['twitter'] = {
|
||||
consumerKey: 'twitterTestId',
|
||||
consumerSecret: 'twitterTestSecret',
|
||||
};
|
||||
const github: AuthConfig['github'] = {
|
||||
clientID: 'githubTestId',
|
||||
clientSecret: 'githubTestSecret',
|
||||
};
|
||||
const dropbox: AuthConfig['dropbox'] = {
|
||||
clientID: 'dropboxTestId',
|
||||
clientSecret: 'dropboxTestSecret',
|
||||
appKey: 'dropboxTestKey',
|
||||
};
|
||||
const google: AuthConfig['google'] = {
|
||||
clientID: 'googleTestId',
|
||||
clientSecret: 'googleTestSecret',
|
||||
|
@ -155,10 +129,7 @@ describe('FrontendConfigService', () => {
|
|||
},
|
||||
];
|
||||
for (const authConfigConfigured of [
|
||||
facebook,
|
||||
twitter,
|
||||
github,
|
||||
dropbox,
|
||||
google,
|
||||
gitlab,
|
||||
ldap,
|
||||
|
@ -211,16 +182,6 @@ describe('FrontendConfigService', () => {
|
|||
}).compile();
|
||||
const service = module.get(FrontendConfigService);
|
||||
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) {
|
||||
expect(config.authProviders).toContainEqual({
|
||||
type: AuthProviderType.GOOGLE,
|
||||
|
@ -236,11 +197,6 @@ describe('FrontendConfigService', () => {
|
|||
type: AuthProviderType.LOCAL,
|
||||
});
|
||||
}
|
||||
if (authConfig.twitter.consumerKey) {
|
||||
expect(config.authProviders).toContainEqual({
|
||||
type: AuthProviderType.TWITTER,
|
||||
});
|
||||
}
|
||||
expect(
|
||||
config.authProviders.filter(
|
||||
(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
|
||||
*/
|
||||
|
@ -66,16 +66,6 @@ export class FrontendConfigService {
|
|||
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) {
|
||||
providers.push({
|
||||
type: AuthProviderType.GITHUB,
|
||||
|
@ -86,11 +76,6 @@ export class FrontendConfigService {
|
|||
type: AuthProviderType.GOOGLE,
|
||||
});
|
||||
}
|
||||
if (this.authConfig.twitter.consumerKey) {
|
||||
providers.push({
|
||||
type: AuthProviderType.TWITTER,
|
||||
});
|
||||
}
|
||||
this.authConfig.gitlab.forEach((gitLabEntry) => {
|
||||
providers.push({
|
||||
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
|
||||
*/
|
||||
|
@ -18,7 +18,7 @@ import { ProviderType } from './provider-type.enum';
|
|||
/**
|
||||
* The identity represents a single way for a user to login.
|
||||
* 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.
|
||||
*/
|
||||
@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
|
||||
*/
|
||||
|
@ -11,8 +11,5 @@ export enum ProviderType {
|
|||
OAUTH2 = 'oauth2',
|
||||
GITLAB = 'gitlab',
|
||||
GITHUB = 'github',
|
||||
FACEBOOK = 'facebook',
|
||||
TWITTER = 'twitter',
|
||||
DROPBOX = 'dropbox',
|
||||
GOOGLE = 'google',
|
||||
}
|
||||
|
|
|
@ -52,9 +52,6 @@ using one of the supported authentication methods:
|
|||
- OAuth2
|
||||
- GitLab
|
||||
- GitHub
|
||||
- Facebook
|
||||
- Twitter
|
||||
- Dropbox
|
||||
- Google
|
||||
|
||||
The `SessionGuard`, which is added to each (appropriate) controller method of the private API,
|
||||
|
|
|
@ -54,10 +54,6 @@
|
|||
max-width: 1440px;
|
||||
}
|
||||
|
||||
.twitter {
|
||||
color: #1DA1F2;
|
||||
}
|
||||
|
||||
.mastodon {
|
||||
color: #2b90d9;
|
||||
}
|
||||
|
|
|
@ -20,18 +20,9 @@ export const branding = {
|
|||
}
|
||||
|
||||
export const authProviders = [
|
||||
{
|
||||
type: AuthProviderType.FACEBOOK
|
||||
},
|
||||
{
|
||||
type: AuthProviderType.GITHUB
|
||||
},
|
||||
{
|
||||
type: AuthProviderType.TWITTER
|
||||
},
|
||||
{
|
||||
type: AuthProviderType.DROPBOX
|
||||
},
|
||||
{
|
||||
type: AuthProviderType.GOOGLE
|
||||
},
|
||||
|
|
|
@ -24,11 +24,8 @@ export enum GuestAccessLevel {
|
|||
}
|
||||
|
||||
export enum AuthProviderType {
|
||||
DROPBOX = 'dropbox',
|
||||
FACEBOOK = 'facebook',
|
||||
GITHUB = 'github',
|
||||
GOOGLE = 'google',
|
||||
TWITTER = 'twitter',
|
||||
GITLAB = 'gitlab',
|
||||
OAUTH2 = 'oauth2',
|
||||
LDAP = 'ldap',
|
||||
|
@ -43,22 +40,16 @@ export type AuthProviderTypeWithCustomName =
|
|||
| AuthProviderType.SAML
|
||||
|
||||
export type AuthProviderTypeWithoutCustomName =
|
||||
| AuthProviderType.DROPBOX
|
||||
| AuthProviderType.FACEBOOK
|
||||
| AuthProviderType.GITHUB
|
||||
| AuthProviderType.GOOGLE
|
||||
| AuthProviderType.TWITTER
|
||||
| AuthProviderType.LOCAL
|
||||
|
||||
export const authProviderTypeOneClick = [
|
||||
AuthProviderType.DROPBOX,
|
||||
AuthProviderType.FACEBOOK,
|
||||
AuthProviderType.GITHUB,
|
||||
AuthProviderType.GITLAB,
|
||||
AuthProviderType.GOOGLE,
|
||||
AuthProviderType.OAUTH2,
|
||||
AuthProviderType.SAML,
|
||||
AuthProviderType.TWITTER
|
||||
AuthProviderType.SAML
|
||||
]
|
||||
|
||||
export interface AuthProviderWithCustomName {
|
||||
|
|
|
@ -6,14 +6,11 @@
|
|||
import styles from './via-one-click.module.scss'
|
||||
import type { Icon } from 'react-bootstrap-icons'
|
||||
import {
|
||||
Dropbox as IconDropbox,
|
||||
Exclamation as IconExclamation,
|
||||
Facebook as IconFacebook,
|
||||
Github as IconGithub,
|
||||
Google as IconGoogle,
|
||||
People as IconPeople,
|
||||
PersonRolodex as IconPersonRolodex,
|
||||
Twitter as IconTwitter
|
||||
PersonRolodex as IconPersonRolodex
|
||||
} from 'react-bootstrap-icons'
|
||||
import { Logger } from '../../../utils/logger'
|
||||
import type { AuthProvider } from '../../../api/config/types'
|
||||
|
@ -41,20 +38,6 @@ const logger = new Logger('GetOneClickProviderMetadata')
|
|||
*/
|
||||
export const getOneClickProviderMetadata = (provider: AuthProvider): OneClickMetadata => {
|
||||
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:
|
||||
return {
|
||||
name: 'GitHub',
|
||||
|
@ -90,13 +73,6 @@ export const getOneClickProviderMetadata = (provider: AuthProvider): OneClickMet
|
|||
className: 'btn-success',
|
||||
url: getBackendAuthUrl(provider.identifier)
|
||||
}
|
||||
case AuthProviderType.TWITTER:
|
||||
return {
|
||||
name: 'Twitter',
|
||||
icon: IconTwitter,
|
||||
className: styles['btn-social-twitter'],
|
||||
url: getBackendAuthUrl('twitter')
|
||||
}
|
||||
default:
|
||||
logger.warn('Metadata for one-click-provider does not exist', provider)
|
||||
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
|
||||
*/
|
||||
|
@ -12,14 +12,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.btn-social-dropbox {
|
||||
@include button(#1087DD);
|
||||
}
|
||||
|
||||
.btn-social-facebook {
|
||||
@include button(#3B5998);
|
||||
}
|
||||
|
||||
.btn-social-github {
|
||||
@include button(#444444);
|
||||
}
|
||||
|
@ -31,7 +23,3 @@
|
|||
.btn-social-google {
|
||||
@include button(#DD4B39);
|
||||
}
|
||||
|
||||
.btn-social-twitter {
|
||||
@include button(#55ACEE);
|
||||
}
|
||||
|
|
|
@ -39,18 +39,9 @@ const initialConfig: FrontendConfig = {
|
|||
{
|
||||
type: AuthProviderType.LOCAL
|
||||
},
|
||||
{
|
||||
type: AuthProviderType.FACEBOOK
|
||||
},
|
||||
{
|
||||
type: AuthProviderType.GITHUB
|
||||
},
|
||||
{
|
||||
type: AuthProviderType.TWITTER
|
||||
},
|
||||
{
|
||||
type: AuthProviderType.DROPBOX
|
||||
},
|
||||
{
|
||||
type: AuthProviderType.GOOGLE
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue