Test dispatch of action delivering bearer token

This commit is contained in:
Julius Gruber
2019-06-18 15:59:11 +02:00
parent 0355ff3e47
commit 70c9050fad
2 changed files with 13 additions and 4 deletions

View File

@@ -116,7 +116,15 @@ export class AuthService {
public startShibbAuth(): Observable<AuthStatus> { public startShibbAuth(): Observable<AuthStatus> {
console.log('startShibAuth() was called'); console.log('startShibAuth() was called');
return this.authRequestService.postToEndpoint('login').pipe( // Attempt authenticating the user using the supplied credentials.
const user = 'test@test.at';
const password = 'rest'
const body = (`password=${Base64EncodeUrl(password)}&user=${Base64EncodeUrl(user)}`);
const options: HttpOptions = Object.create({});
let headers = new HttpHeaders();
headers = headers.append('Content-Type', 'application/x-www-form-urlencoded');
options.headers = headers;
return this.authRequestService.postToEndpoint('login', body, options).pipe(
map((status: AuthStatus) => { map((status: AuthStatus) => {
if (status.authenticated) { if (status.authenticated) {
return status; return status;
@@ -124,6 +132,7 @@ export class AuthService {
throw(new Error('Invalid email or password')); throw(new Error('Invalid email or password'));
} }
})) }))
} }
/** /**

View File

@@ -38,17 +38,17 @@
<a class="btn btn-lg btn-primary btn-block mt-2" <a class="btn btn-lg btn-primary btn-block mt-2"
href="https://fis.tiss.tuwien.ac.at/Shibboleth.sso/Login" href="https://fis.tiss.tuwien.ac.at/Shibboleth.sso/Login"
role="button" role="button"
(click)="dispatchShibbLoginAction()">HardCoded Shibb</a> >HardCoded Shibb</a>
</div> </div>
<!-- <div > <div >
<br> <br>
<a class="btn btn-lg btn-primary btn-block mt-2" (click)="dispatchShibbLoginAction()" role="button">Dispatch Shibb Login</a> <a class="btn btn-lg btn-primary btn-block mt-2" (click)="dispatchShibbLoginAction()" role="button">Dispatch Shibb Login</a>
</div> </div>
<div > <!-- <div >
<br> <br>
<a class="btn btn-lg btn-primary btn-block mt-2" (click)="postLoginCall()" role="button">Simple Post Login</a> <a class="btn btn-lg btn-primary btn-block mt-2" (click)="postLoginCall()" role="button">Simple Post Login</a>
</div>--> </div>-->