Added logs for server debug

This commit is contained in:
Julius Gruber
2019-06-27 15:19:30 +02:00
parent 7c243623c8
commit 71f281516a
5 changed files with 11 additions and 44 deletions

View File

@@ -10,7 +10,7 @@ import {AuthTokenInfo} from './models/auth-token-info.model';
export const AuthActionTypes = { export const AuthActionTypes = {
AUTHENTICATE: type('dspace/auth/AUTHENTICATE'), AUTHENTICATE: type('dspace/auth/AUTHENTICATE'),
SHIBB_LOGIN: type('dspace/auth/SHIBB_LOGIN'), GET_JWT_AFTER_SHIBB_LOGIN: type('dspace/auth/GET_JWT_AFTER_SHIBB_LOGIN'),
AUTHENTICATE_ERROR: type('dspace/auth/AUTHENTICATE_ERROR'), AUTHENTICATE_ERROR: type('dspace/auth/AUTHENTICATE_ERROR'),
AUTHENTICATE_SUCCESS: type('dspace/auth/AUTHENTICATE_SUCCESS'), AUTHENTICATE_SUCCESS: type('dspace/auth/AUTHENTICATE_SUCCESS'),
AUTHENTICATED: type('dspace/auth/AUTHENTICATED'), AUTHENTICATED: type('dspace/auth/AUTHENTICATED'),
@@ -62,7 +62,7 @@ export class AuthenticateAction implements Action {
* @implements {Action} * @implements {Action}
*/ */
export class GetJWTafterShibbLoginAction implements Action { export class GetJWTafterShibbLoginAction implements Action {
public type: string = AuthActionTypes.SHIBB_LOGIN; public type: string = AuthActionTypes.GET_JWT_AFTER_SHIBB_LOGIN;
} }
/** /**

View File

@@ -64,7 +64,7 @@ export class AuthEffects {
*/ */
@Effect() @Effect()
public shibbLogin$: Observable<Action> = this.actions$.pipe( public shibbLogin$: Observable<Action> = this.actions$.pipe(
ofType(AuthActionTypes.SHIBB_LOGIN), ofType(AuthActionTypes.GET_JWT_AFTER_SHIBB_LOGIN),
switchMap((action: GetJWTafterShibbLoginAction) => { switchMap((action: GetJWTafterShibbLoginAction) => {
return this.authService.startShibbAuth().pipe( return this.authService.startShibbAuth().pipe(
take(1), take(1),

View File

@@ -78,7 +78,7 @@ export function authReducer(state: any = initialState, action: AuthActions): Aut
info: undefined info: undefined
}); });
case AuthActionTypes.SHIBB_LOGIN: case AuthActionTypes.GET_JWT_AFTER_SHIBB_LOGIN:
return Object.assign({}, state, { return Object.assign({}, state, {
error: undefined, error: undefined,
loading: true, loading: true,

View File

@@ -33,6 +33,11 @@
role="button">{{"login.form.ssoLogin" | translate}}</a> role="button">{{"login.form.ssoLogin" | translate}}</a>
</div> </div>
<!--Change href to "https://dspace.hostname/Shibboleth.sso/Login?target=https://dspace.hostname/shibboleth"
to make this work with your Shibboleth IdentityProvider and Service Provider. dspace.hostname = as in the
backend config file "dspace.cfg". Do not change the following parts of href:
"/Shibboleth.sso/Login?target=" and "/shibboleth" at the end of href -->
<br> <br>
<div> <div>
<a class="btn btn-lg btn-primary btn-block mt-2" <a class="btn btn-lg btn-primary btn-block mt-2"
@@ -42,17 +47,8 @@
</div> </div>
<!-- <div >
<br>
<a class="btn btn-lg btn-primary btn-block mt-2" (click)="dispatchShibbLoginAction()" role="button">Dispatch Shibb Login</a>
</div>-->
<!-- <div >
<br>
<a class="btn btn-lg btn-primary btn-block mt-2" (click)="postLoginCall()" role="button">Simple Post Login</a>
</div>-->
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">{{"login.form.new-user" | translate}}</a> <a class="dropdown-item" href="#">{{"login.form.new-user" | translate}}</a>

View File

@@ -112,7 +112,7 @@ export class LogInComponent implements OnDestroy, OnInit {
* @method ngOnInit * @method ngOnInit
*/ */
public ngOnInit() { public ngOnInit() {
console.log('log-in.componetn.ngOnInit() called'); console.log('log-in.component.ngOnInit() called');
// set isAuthenticated // set isAuthenticated
this.isAuthenticated = this.store.pipe(select(isAuthenticated)); this.isAuthenticated = this.store.pipe(select(isAuthenticated));
@@ -145,6 +145,7 @@ export class LogInComponent implements OnDestroy, OnInit {
// set sso login url // set sso login url
this.ssoLoginUrl = this.store.pipe(select(getSSOLoginUrl)); this.ssoLoginUrl = this.store.pipe(select(getSSOLoginUrl));
this.ssoLoginUrl.subscribe((url) => console.log('url after store select: ', url));
// subscribe to success // subscribe to success
this.store.pipe( this.store.pipe(
@@ -211,34 +212,4 @@ export class LogInComponent implements OnDestroy, OnInit {
this.form.reset(); this.form.reset();
} }
/* public postLoginCall() {
console.log('postLoginCall() was called');
/!* const email = 'test@test.at';
const password = 'test';
this.store.dispatch(new AuthenticateAction(email, password));*!/
this.http.post('https://fis.tiss.tuwien.ac.at/spring-rest/api/authn/login',
{
name: 'morpheus',
job: 'leader'
})
.subscribe(
(val) => {
console.log('POST call successful value returned in body',
val);
},
(response) => {
console.log('POST call in error', response);
},
() => {
console.log('The POST observable is now completed.');
});
}*/
dispatchShibbLoginAction() {
console.log('dispatchShibbLoginAction() was called');
// const ssoLoginUrl = 'https://fis.tiss.tuwien.ac.at/Shibboleth.sso/Login'
this.store.dispatch(new GetJWTafterShibbLoginAction());
// this.store.dispatch(new AuthenticateAction(email, password));
}
} }