You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 8, 2020. It is now read-only.
Implement an abstract AuthService with concrete JwtAuthService extends AuthService implementation.
This component should be split across the stack, as in the browser HttpService should utilize a separate injectable component for authenticating requests.
For now, just implement roleless authentication, roles & permissions will be handled later in a more complex RBAC component (Yii style).
As the complexity is relatively low, also implement BasicAuthService using http basic auth, mostly as demonstration of the abstraction of the auth service.
Initial implementation thoughts:
@Authenticate
@Route('GET','/something-secure')publicgetSecureThing(request: Request,response: Response): Response{returnPromise.all([this.secretStore.get(response.param('id')),this.auth.getAuthenticated()//try to avoid getUser() as the authenticated member could be another service]).then((res)=>{const[authenticated,thing]=res;if(!thing.isOwnedBy(authenticated)){thrownewForbiddenException();}returnresponse.data(thing);})}