ffff
ffff

Reputation: 35

Authorization - Angular + Spring + wso2

I've never implemented an application that needed to handle user authentication and authorization.

Now I'm trying to implement an app that has a front-end build with angular and a back-end build with spring security. And I want to user Wso2 identity server as an identity provider.

My doubt is, should i use a library like angular-oauth2-oidc or Asgardeo in the front-end and call the endpoint for the identity server authorization server from here; or should I call an api that I should implement in the backend and that api calls the identity server authorization server endpoint and returns to the front-end the access token generated?

Upvotes: 0

Views: 340

Answers (1)

ch4mp
ch4mp

Reputation: 12754

Use an OIDC client lib for Angular. My favorite is angular-auth-oidc-client. It will handle:

  • redirections to and from authorization-server
  • exchange of authorization code for tokens
  • access-token refreshing (silently, just before it expires)
  • requests authorization (HTTP interceptor to set authorization header with access-token)

It also provides with Angular route guard to redirect to login when an unauthorized user tries to activate a protected route.

Upvotes: 0

Related Questions