Feature/custom oauth saml names (#31)

* using saml and oauth2 customAuthNames in login
* add saml and oauth2 customAuthNames to backend config
* changed default name of oauth button

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2020-05-16 20:38:02 +02:00 committed by GitHub
parent 83ab0bbe7e
commit aeeb08ea5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 8 deletions

View file

@ -7,13 +7,15 @@
"gitlab": true,
"dropbox": true,
"ldap": true,
"google": false,
"saml": false,
"oauth2": false,
"google": true,
"saml": true,
"oauth2": true,
"email": true
},
"customAuthNames": {
"ldap": "FooBar"
"ldap": "FooBar",
"saml": "aufSAMLn.de",
"oauth2": "Olaf2"
},
"specialLinks": {
"privacy": "test",

View file

@ -63,7 +63,7 @@ const getMetadata: OAuth2Map = (oauth2type: OAuth2Type) => {
}
case OAuth2Type.OAUTH2:
return {
name: "oAuth2",
name: "OAuth2",
icon: "share",
className: "btn-primary",
url: buildBackendAuthUrl("oauth2")

View file

@ -10,11 +10,22 @@ import {ApplicationState} from "../../../../redux";
const Login: React.FC = () => {
useTranslation();
const authProviders = useSelector((state: ApplicationState) => state.backendConfig.authProviders);
const customAuthNames = useSelector((state: ApplicationState) => state.backendConfig.customAuthNames);
const emailForm = authProviders.email ? <ViaEMail/> : null
const ldapForm = authProviders.ldap ? <ViaLdap/> : null
const emailLdapSeperator = authProviders.email && authProviders.ldap ? <hr className="w-100 bg-white"/> : null
const oauth2CustomName: (type: OAuth2Type) => string | undefined = (type) => {
switch (type) {
case OAuth2Type.SAML:
return customAuthNames.saml;
case OAuth2Type.OAUTH2:
return customAuthNames.oauth2;
default:
return undefined;
}
}
return (
<Jumbotron className="bg-dark">
<div className="my-3">
@ -45,7 +56,10 @@ const Login: React.FC = () => {
className="p-2 d-flex flex-column"
key={value}
>
<ViaOAuth2 oauth2Type={value}/>
<ViaOAuth2
oauth2Type={value}
optionalName={oauth2CustomName(value)}
/>
</Col>
)
})

View file

@ -16,7 +16,9 @@ export const initialState: BackendConfigState = {
email: false
},
customAuthNames: {
ldap: ""
ldap: "",
saml: "",
oauth2: ""
},
specialLinks: {
privacy: "",

View file

@ -24,6 +24,8 @@ export interface AuthProvidersState {
export interface CustomAuthNames {
ldap: string;
saml: string;
oauth2: string;
}
export interface SpecialLinks {