mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
[DURACOM-191] set map for login methods
This commit is contained in:
@@ -13,8 +13,6 @@ import { AuthService } from '../../../../core/auth/auth.service';
|
|||||||
import { HardRedirectService } from '../../../../core/services/hard-redirect.service';
|
import { HardRedirectService } from '../../../../core/services/hard-redirect.service';
|
||||||
import { URLCombiner } from '../../../../core/url-combiner/url-combiner';
|
import { URLCombiner } from '../../../../core/url-combiner/url-combiner';
|
||||||
import { CoreState } from '../../../../core/core-state.model';
|
import { CoreState } from '../../../../core/core-state.model';
|
||||||
import { renderAuthMethodFor } from '../log-in.methods-decorator';
|
|
||||||
import { AuthMethodType } from '../../../../core/auth/models/auth.method-type';
|
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -24,9 +22,6 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [TranslateModule]
|
imports: [TranslateModule]
|
||||||
})
|
})
|
||||||
@renderAuthMethodFor(AuthMethodType.Oidc)
|
|
||||||
@renderAuthMethodFor(AuthMethodType.Shibboleth)
|
|
||||||
@renderAuthMethodFor(AuthMethodType.Orcid)
|
|
||||||
export class LogInExternalProviderComponent implements OnInit {
|
export class LogInExternalProviderComponent implements OnInit {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,8 +1,14 @@
|
|||||||
import { Component, Type } from '@angular/core';
|
import { Component, Type } from '@angular/core';
|
||||||
import { AuthMethodType } from '../../../core/auth/models/auth.method-type';
|
import { AuthMethodType } from '../../../core/auth/models/auth.method-type';
|
||||||
|
import { LogInPasswordComponent } from './password/log-in-password.component';
|
||||||
|
import { LogInExternalProviderComponent } from './log-in-external-provider/log-in-external-provider.component';
|
||||||
|
|
||||||
const authMethodsMap: Map<AuthMethodType, Type<Component>> = new Map();
|
const authMethodsMap: Map<AuthMethodType, any> = new Map();
|
||||||
|
|
||||||
|
authMethodsMap.set(AuthMethodType.Password, LogInPasswordComponent);
|
||||||
|
authMethodsMap.set(AuthMethodType.Shibboleth, LogInExternalProviderComponent);
|
||||||
|
authMethodsMap.set(AuthMethodType.Oidc, LogInExternalProviderComponent);
|
||||||
|
authMethodsMap.set(AuthMethodType.Orcid, LogInExternalProviderComponent);
|
||||||
export function renderAuthMethodFor(authMethodType: AuthMethodType) {
|
export function renderAuthMethodFor(authMethodType: AuthMethodType) {
|
||||||
return function decorator(objectElement: any) {
|
return function decorator(objectElement: any) {
|
||||||
if (!objectElement) {
|
if (!objectElement) {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { Component, Inject, OnInit } from '@angular/core';
|
import { Component, Inject, OnInit } from '@angular/core';
|
||||||
import { UntypedFormBuilder, UntypedFormGroup, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
||||||
|
|
||||||
import { select, Store } from '@ngrx/store';
|
import { select, Store } from '@ngrx/store';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
@@ -9,8 +9,6 @@ import { AuthenticateAction, ResetAuthenticationMessagesAction } from '../../../
|
|||||||
import { getAuthenticationError, getAuthenticationInfo, } from '../../../../core/auth/selectors';
|
import { getAuthenticationError, getAuthenticationInfo, } from '../../../../core/auth/selectors';
|
||||||
import { isNotEmpty } from '../../../empty.util';
|
import { isNotEmpty } from '../../../empty.util';
|
||||||
import { fadeOut } from '../../../animations/fade';
|
import { fadeOut } from '../../../animations/fade';
|
||||||
import { AuthMethodType } from '../../../../core/auth/models/auth.method-type';
|
|
||||||
import { renderAuthMethodFor } from '../log-in.methods-decorator';
|
|
||||||
import { AuthMethod } from '../../../../core/auth/models/auth.method';
|
import { AuthMethod } from '../../../../core/auth/models/auth.method';
|
||||||
import { AuthService } from '../../../../core/auth/auth.service';
|
import { AuthService } from '../../../../core/auth/auth.service';
|
||||||
import { HardRedirectService } from '../../../../core/services/hard-redirect.service';
|
import { HardRedirectService } from '../../../../core/services/hard-redirect.service';
|
||||||
@@ -21,7 +19,7 @@ import { AuthorizationDataService } from '../../../../core/data/feature-authoriz
|
|||||||
import { BrowserOnlyPipe } from '../../../utils/browser-only.pipe';
|
import { BrowserOnlyPipe } from '../../../utils/browser-only.pipe';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { RouterLink } from '@angular/router';
|
import { RouterLink } from '@angular/router';
|
||||||
import { NgIf, AsyncPipe } from '@angular/common';
|
import { AsyncPipe, NgIf } from '@angular/common';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* /users/sign-in
|
* /users/sign-in
|
||||||
@@ -35,7 +33,6 @@ import { NgIf, AsyncPipe } from '@angular/common';
|
|||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [FormsModule, ReactiveFormsModule, NgIf, RouterLink, AsyncPipe, TranslateModule, BrowserOnlyPipe]
|
imports: [FormsModule, ReactiveFormsModule, NgIf, RouterLink, AsyncPipe, TranslateModule, BrowserOnlyPipe]
|
||||||
})
|
})
|
||||||
@renderAuthMethodFor(AuthMethodType.Password)
|
|
||||||
export class LogInPasswordComponent implements OnInit {
|
export class LogInPasswordComponent implements OnInit {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user