mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 10:34:15 +00:00
Added mock components for dynamic login components
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {GetJWTafterShibbLoginAction} from '../../core/auth/auth.actions';
|
import {GetJWTafterShibbLoginAction} from '../../core/auth/auth.actions';
|
||||||
import {Store} from '@ngrx/store';
|
import {Store} from '@ngrx/store';
|
||||||
import {CoreState} from '../../core/core.reducers';
|
import {CoreState} from '../../core/core.reducers';
|
||||||
@@ -22,6 +22,7 @@ export class ShibbolethComponent implements OnInit {
|
|||||||
this.store.dispatch(new GetJWTafterShibbLoginAction());
|
this.store.dispatch(new GetJWTafterShibbLoginAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor( private store: Store<CoreState>,) { }
|
constructor(private store: Store<CoreState>,) {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -32,8 +32,6 @@ export class AuthInterceptor implements HttpInterceptor {
|
|||||||
// we're creating a refresh token request list
|
// we're creating a refresh token request list
|
||||||
protected refreshTokenRequestUrls = [];
|
protected refreshTokenRequestUrls = [];
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
constructor(private inj: Injector, private router: Router, private store: Store<AppState>) {
|
constructor(private inj: Injector, private router: Router, private store: Store<AppState>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +87,7 @@ export class AuthInterceptor implements HttpInterceptor {
|
|||||||
const authMethod: AuthMethodModel = new AuthMethodModel(methodName);
|
const authMethod: AuthMethodModel = new AuthMethodModel(methodName);
|
||||||
// check if the authentication method is shibboleth
|
// check if the authentication method is shibboleth
|
||||||
// if so the next part is the shibboleth location
|
// if so the next part is the shibboleth location
|
||||||
// e.g part i: shibboleth realm="DSpace REST API", part i+1: location="/Shibboleth.sso/Login?target=https%3A%2F%2Flocalhost%3A8080"
|
// e.g part i: shibboleth realm="DSpace REST API", part i+1: location="/Shibboleth.sso/Login?target=https://serverUrl"
|
||||||
if (methodName.includes('shibboleth')) {
|
if (methodName.includes('shibboleth')) {
|
||||||
const location: string = this.parseShibbolethLocation(parts[+i + 1]); // +1: unaray + operator is necessaray because i is a string, the operator works like parseInt()
|
const location: string = this.parseShibbolethLocation(parts[+i + 1]); // +1: unaray + operator is necessaray because i is a string, the operator works like parseInt()
|
||||||
// console.log('shib location: ', location);
|
// console.log('shib location: ', location);
|
||||||
@@ -98,7 +96,7 @@ export class AuthInterceptor implements HttpInterceptor {
|
|||||||
authMethodModels.push(authMethod);
|
authMethodModels.push(authMethod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('Array of AuthMethodModels: ', authMethodModels);
|
// console.log('Array of AuthMethodModels: ', authMethodModels);
|
||||||
return authMethodModels;
|
return authMethodModels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,18 +7,27 @@ export class AuthMethodModel {
|
|||||||
this.authMethodName = authMethodName;
|
this.authMethodName = authMethodName;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
switch (authMethodName) {
|
switch (authMethodName) {
|
||||||
case 'password': {
|
case 'ip': {
|
||||||
this.authMethodConstant = AuthMethodConstants.PASSWORD;
|
this.authMethodConstant = AuthMethodConstants.IP;
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'shibboleth': {
|
|
||||||
this.authMethodConstant = AuthMethodConstants.SHIBBOLETH;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'ldap': {
|
case 'ldap': {
|
||||||
this.authMethodConstant = AuthMethodConstants.LDAP;
|
this.authMethodConstant = AuthMethodConstants.LDAP;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'shibboleth': {
|
||||||
|
this.authMethodConstant = AuthMethodConstants.SHIBBOLETH;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'x509': {
|
||||||
|
this.authMethodConstant = AuthMethodConstants.X509;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'password': {
|
||||||
|
this.authMethodConstant = AuthMethodConstants.PASSWORD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -27,7 +36,9 @@ export class AuthMethodModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export enum AuthMethodConstants {
|
export enum AuthMethodConstants {
|
||||||
PASSWORD,
|
IP,
|
||||||
|
LDAP,
|
||||||
SHIBBOLETH,
|
SHIBBOLETH,
|
||||||
LDAP
|
X509,
|
||||||
|
PASSWORD,
|
||||||
}
|
}
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
<h1>This is the DynamicTestComponent</h1>
|
|
@@ -1,21 +0,0 @@
|
|||||||
/**
|
|
||||||
* /users/sign-in
|
|
||||||
* @class LogInComponent
|
|
||||||
*/
|
|
||||||
import {Component, OnInit} from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'ds-dynamic-test',
|
|
||||||
templateUrl: './dynamic-test.component.html',
|
|
||||||
styleUrls: ['./dynamic-test.component.scss'],
|
|
||||||
|
|
||||||
})
|
|
||||||
export class DynamicTestComponent {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
constructor() {
|
|
||||||
// console.log('constructor of DynamicTestComponent called');
|
|
||||||
}
|
|
||||||
}
|
|
1
src/app/shared/log-in/ip/dynamic-ip.component.html
Normal file
1
src/app/shared/log-in/ip/dynamic-ip.component.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<div>IP based login component - to be implemented</div>
|
21
src/app/shared/log-in/ip/dynamic-ip.component.ts
Normal file
21
src/app/shared/log-in/ip/dynamic-ip.component.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* /users/sign-in
|
||||||
|
* @class LogInComponent
|
||||||
|
*/
|
||||||
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-dynamic-ip',
|
||||||
|
templateUrl: './dynamic-ip.component.html',
|
||||||
|
styleUrls: ['./dynamic-ip.component.scss'],
|
||||||
|
|
||||||
|
})
|
||||||
|
export class DynamicIpComponent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
constructor() {
|
||||||
|
// console.log('constructor of DynamicLdapComponent called');
|
||||||
|
}
|
||||||
|
}
|
1
src/app/shared/log-in/ldap/dynamic-ldap.component.html
Normal file
1
src/app/shared/log-in/ldap/dynamic-ldap.component.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<div>LDAP login component - to be implemented</div>
|
21
src/app/shared/log-in/ldap/dynamic-ldap.component.ts
Normal file
21
src/app/shared/log-in/ldap/dynamic-ldap.component.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* /users/sign-in
|
||||||
|
* @class LogInComponent
|
||||||
|
*/
|
||||||
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-dynamic-ldap',
|
||||||
|
templateUrl: './dynamic-ldap.component.html',
|
||||||
|
styleUrls: ['./dynamic-ldap.component.scss'],
|
||||||
|
|
||||||
|
})
|
||||||
|
export class DynamicLdapComponent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
constructor() {
|
||||||
|
// console.log('constructor of DynamicLdapComponent called');
|
||||||
|
}
|
||||||
|
}
|
@@ -1,21 +1,21 @@
|
|||||||
import {Component, Injector, OnDestroy, OnInit, ReflectiveInjector} from '@angular/core';
|
import {Component, Injector, OnDestroy, OnInit} from '@angular/core';
|
||||||
import {AuthState} from '../../../core/auth/auth.reducer';
|
|
||||||
import {Store} from '@ngrx/store';
|
import {Store} from '@ngrx/store';
|
||||||
import {DynamicTestComponent} from '../DynamicTestComponent/dynamic-test.component';
|
|
||||||
import {LogInComponent} from '../password/log-in.component';
|
import {LogInComponent} from '../password/log-in.component';
|
||||||
import {DynamicShibbolethComponent} from '../shibboleth/dynamic-shibboleth.component';
|
import {DynamicShibbolethComponent} from '../shibboleth/dynamic-shibboleth.component';
|
||||||
import {getAuthenticationMethods} from '../../../core/auth/selectors';
|
import {getAuthenticationMethods} from '../../../core/auth/selectors';
|
||||||
import {map, tap} from 'rxjs/operators';
|
import {map} from 'rxjs/operators';
|
||||||
import {AppState} from '../../../app.reducer';
|
import {AppState} from '../../../app.reducer';
|
||||||
import {Observable} from 'rxjs';
|
import {Observable} from 'rxjs';
|
||||||
import {DynamicLoginMethod} from './log-in-container.model';
|
import {DynamicLoginMethod} from './log-in-container.model';
|
||||||
import {AuthMethodConstants, AuthMethodModel} from '../../../core/auth/models/auth-method.model';
|
import {AuthMethodConstants} from '../../../core/auth/models/auth-method.model';
|
||||||
import {ShibbolethComponent} from '../../../+login-page/shibboleth/shibboleth.component';
|
import {DynamicLdapComponent} from '../ldap/dynamic-ldap.component';
|
||||||
|
import {DynamicX509Component} from '../x509/dynamic-x509.component';
|
||||||
|
import {DynamicIpComponent} from '../ip/dynamic-ip.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-log-in-container',
|
selector: 'ds-log-in-container',
|
||||||
templateUrl: './log-in-container.component.html',
|
templateUrl: './log-in-container.component.html',
|
||||||
// styleUrls: ['./log-in.component.scss'],
|
styleUrls: ['./log-in-container.component.scss'],
|
||||||
|
|
||||||
})
|
})
|
||||||
export class LogInContainerComponent implements OnDestroy, OnInit {
|
export class LogInContainerComponent implements OnDestroy, OnInit {
|
||||||
@@ -50,8 +50,8 @@ export class LogInContainerComponent implements OnDestroy, OnInit {
|
|||||||
this.objectInjector = Injector.create({
|
this.objectInjector = Injector.create({
|
||||||
providers: [
|
providers: [
|
||||||
{provide: 'shibbolethUrlProvider', useFactory: () => (this.shibbolethUrl), deps: []},
|
{provide: 'shibbolethUrlProvider', useFactory: () => (this.shibbolethUrl), deps: []},
|
||||||
// {provide: 'sectionDataProvider', useFactory: () => (this.sectionData), deps: []},
|
// if other authentication methods need further data to work add a provider here e.g
|
||||||
// {provide: 'submissionIdProvider', useFactory: () => (this.submissionId), deps: []},
|
// {provide: 'otherDataProvider', useFactory: () => (this.otherData), deps: []},
|
||||||
],
|
],
|
||||||
parent: this.injector
|
parent: this.injector
|
||||||
});
|
});
|
||||||
@@ -67,6 +67,15 @@ export class LogInContainerComponent implements OnDestroy, OnInit {
|
|||||||
this.shibbolethUrl = 'https://fis.tiss.tuwien.ac.at/Shibboleth.sso/Login?target=https://fis.tiss.tuwien.ac.at/shibboleth';
|
this.shibbolethUrl = 'https://fis.tiss.tuwien.ac.at/Shibboleth.sso/Login?target=https://fis.tiss.tuwien.ac.at/shibboleth';
|
||||||
return new DynamicLoginMethod(authMethod.authMethodName, DynamicShibbolethComponent, authMethod.location)
|
return new DynamicLoginMethod(authMethod.authMethodName, DynamicShibbolethComponent, authMethod.location)
|
||||||
break;
|
break;
|
||||||
|
case AuthMethodConstants.LDAP:
|
||||||
|
return new DynamicLoginMethod(authMethod.authMethodName, DynamicLdapComponent)
|
||||||
|
break;
|
||||||
|
case AuthMethodConstants.IP:
|
||||||
|
return new DynamicLoginMethod(authMethod.authMethodName, DynamicIpComponent)
|
||||||
|
break;
|
||||||
|
case AuthMethodConstants.X509:
|
||||||
|
return new DynamicLoginMethod(authMethod.authMethodName, DynamicX509Component)
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -83,10 +92,6 @@ export class LogInContainerComponent implements OnDestroy, OnInit {
|
|||||||
label: 'PasswordComponent',
|
label: 'PasswordComponent',
|
||||||
component: LogInComponent
|
component: LogInComponent
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: 'TestComponent',
|
|
||||||
component: DynamicTestComponent
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: 'ShibbolethComponent',
|
label: 'ShibbolethComponent',
|
||||||
component: DynamicShibbolethComponent
|
component: DynamicShibbolethComponent
|
||||||
|
@@ -20,7 +20,6 @@ import {CoreState} from '../../../core/core.reducers';
|
|||||||
import {isNotEmpty} from '../../empty.util';
|
import {isNotEmpty} from '../../empty.util';
|
||||||
import {fadeOut} from '../../animations/fade';
|
import {fadeOut} from '../../animations/fade';
|
||||||
import {AuthService} from '../../../core/auth/auth.service';
|
import {AuthService} from '../../../core/auth/auth.service';
|
||||||
import {DynamicTestComponent} from '../DynamicTestComponent/dynamic-test.component';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* /users/sign-in
|
* /users/sign-in
|
||||||
@@ -82,7 +81,7 @@ export class LogInComponent implements OnDestroy, OnInit {
|
|||||||
*/
|
*/
|
||||||
private alive = true;
|
private alive = true;
|
||||||
|
|
||||||
dynamicLoginMethods: any;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -103,13 +102,6 @@ export class LogInComponent implements OnDestroy, OnInit {
|
|||||||
*/
|
*/
|
||||||
public ngOnInit() {
|
public ngOnInit() {
|
||||||
|
|
||||||
this.dynamicLoginMethods = this.dynamicLoginMethods = [
|
|
||||||
{
|
|
||||||
label: 'TestComponent',
|
|
||||||
component: DynamicTestComponent
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
// set isAuthenticated
|
// set isAuthenticated
|
||||||
this.isAuthenticated = this.store.pipe(select(isAuthenticated));
|
this.isAuthenticated = this.store.pipe(select(isAuthenticated));
|
||||||
|
|
||||||
|
@@ -1,10 +1,5 @@
|
|||||||
/**
|
|
||||||
* /users/sign-in
|
|
||||||
* @class LogInComponent
|
|
||||||
*/
|
|
||||||
import {Component, Inject, Input, OnInit} from '@angular/core';
|
import {Component, Inject, Input, OnInit} from '@angular/core';
|
||||||
import {InputDecorator} from '@angular/core/src/metadata/directives';
|
|
||||||
import {HttpClient} from '@angular/common/http';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-dynamic-shibboleth',
|
selector: 'ds-dynamic-shibboleth',
|
||||||
|
1
src/app/shared/log-in/x509/dynamic-x509.component.html
Normal file
1
src/app/shared/log-in/x509/dynamic-x509.component.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<div>X509 login component - to be implemented</div>
|
21
src/app/shared/log-in/x509/dynamic-x509.component.ts
Normal file
21
src/app/shared/log-in/x509/dynamic-x509.component.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* /users/sign-in
|
||||||
|
* @class LogInComponent
|
||||||
|
*/
|
||||||
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-dynamic-x509',
|
||||||
|
templateUrl: './dynamic-x509.component.html',
|
||||||
|
styleUrls: ['./dynamic-x509.component.scss'],
|
||||||
|
|
||||||
|
})
|
||||||
|
export class DynamicX509Component {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
constructor() {
|
||||||
|
// console.log('constructor of DynamicLdapComponent called');
|
||||||
|
}
|
||||||
|
}
|
@@ -138,10 +138,12 @@ import { RoleDirective } from './roles/role.directive';
|
|||||||
import { UserMenuComponent } from './auth-nav-menu/user-menu/user-menu.component';
|
import { UserMenuComponent } from './auth-nav-menu/user-menu/user-menu.component';
|
||||||
import { ClaimedTaskActionsReturnToPoolComponent } from './mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component';
|
import { ClaimedTaskActionsReturnToPoolComponent } from './mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component';
|
||||||
import { ItemDetailPreviewFieldComponent } from './object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component';
|
import { ItemDetailPreviewFieldComponent } from './object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component';
|
||||||
import {DynamicTestComponent} from './log-in/DynamicTestComponent/dynamic-test.component';
|
|
||||||
import {LogInContainerComponent} from './log-in/log-in-container/log-in-container.component';
|
import {LogInContainerComponent} from './log-in/log-in-container/log-in-container.component';
|
||||||
import {s} from '@angular/core/src/render3';
|
import {s} from '@angular/core/src/render3';
|
||||||
import {DynamicShibbolethComponent} from './log-in/shibboleth/dynamic-shibboleth.component';
|
import {DynamicShibbolethComponent} from './log-in/shibboleth/dynamic-shibboleth.component';
|
||||||
|
import {DynamicLdapComponent} from './log-in/ldap/dynamic-ldap.component';
|
||||||
|
import {DynamicIpComponent} from './log-in/ip/dynamic-ip.component';
|
||||||
|
import {DynamicX509Component} from './log-in/x509/dynamic-x509.component';
|
||||||
|
|
||||||
const MODULES = [
|
const MODULES = [
|
||||||
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
|
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
|
||||||
@@ -263,7 +265,9 @@ const COMPONENTS = [
|
|||||||
ItemTypeSwitcherComponent,
|
ItemTypeSwitcherComponent,
|
||||||
BrowseByComponent,
|
BrowseByComponent,
|
||||||
LogInContainerComponent,
|
LogInContainerComponent,
|
||||||
DynamicShibbolethComponent
|
DynamicShibbolethComponent,
|
||||||
|
DynamicLdapComponent,
|
||||||
|
DynamicIpComponent
|
||||||
];
|
];
|
||||||
|
|
||||||
const ENTRY_COMPONENTS = [
|
const ENTRY_COMPONENTS = [
|
||||||
@@ -307,10 +311,11 @@ const ENTRY_COMPONENTS = [
|
|||||||
PlainTextMetadataListElementComponent,
|
PlainTextMetadataListElementComponent,
|
||||||
ItemMetadataListElementComponent,
|
ItemMetadataListElementComponent,
|
||||||
MetadataRepresentationListElementComponent,
|
MetadataRepresentationListElementComponent,
|
||||||
DynamicTestComponent,
|
DynamicLdapComponent,
|
||||||
LogInComponent,
|
LogInComponent,
|
||||||
DynamicShibbolethComponent
|
DynamicShibbolethComponent,
|
||||||
|
DynamicIpComponent,
|
||||||
|
DynamicX509Component
|
||||||
];
|
];
|
||||||
|
|
||||||
const SHARED_ITEM_PAGE_COMPONENTS = [
|
const SHARED_ITEM_PAGE_COMPONENTS = [
|
||||||
|
Reference in New Issue
Block a user