Skip to content
Snippets Groups Projects
Commit 7a2c4064 authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Implement RFC 6750 instead of custom header for JWT

RFC 6750:
https://tools.ietf.org/html/rfc6750

Refs arsnova-backend!144.
parent 1d32699e
Branches
Tags
1 merge request!368Implement RFC 6750 instead of custom header for JWT
Pipeline #29691 passed with stages
in 8 minutes and 2 seconds
......@@ -14,7 +14,8 @@ import { NotificationService } from '../services/util/notification.service';
import { Router } from '@angular/router';
import { Observable } from 'rxjs';
const AUTH_HEADER_KEY = 'Arsnova-Auth-Token';
const AUTH_HEADER_KEY = 'Authorization';
const AUTH_SCHEME = 'Bearer';
@Injectable()
export class AuthenticationInterceptor implements HttpInterceptor {
......@@ -28,7 +29,7 @@ export class AuthenticationInterceptor implements HttpInterceptor {
if (this.authenticationService.isLoggedIn()) {
const token = this.authenticationService.getToken();
const cloned = req.clone({
headers: req.headers.set(AUTH_HEADER_KEY, token)
headers: req.headers.set(AUTH_HEADER_KEY, `${AUTH_SCHEME} ${token}`)
});
return next.handle(cloned).pipe(tap((event: HttpEvent<any>) => {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment