In this 2nd part I made a more complex example to be more practical in real life, and created a web app that is gets its users from db and stores the clients, and tokens in db instead of memory so it's more scalable.
features:
1- users & roles in database
2- oauth related info stored in db (tokens, clients, approvals, etc..)
3- two APIs : a- cats apis, b- dogs api; each one of these can be accessed only if the access token has a proper scope (cats scope and dogs scope)
the app uses h2 in memory database so that it be self contained and no external setup is required
and here is the source code :
https://github.com/blabadi/oauth2lw-parent/tree/master/oauth2lw-client-jdbc
show case:
1- get access token to with scope cats:
a- get the auth code :
go to : localhost:8080/oauth/authorize?response_type=code&client_id=cats-client&redirect_uri=http://localhostcats/redirect
2- login with a user
3- approve the scopes :
4- get the authorization code
5- exchange the code for a token
6- access cats api:
7- try the dogs api
try to get a valid token to access the dogs api by yourself should be similar to the cats process..
get familiar with the source code, it's only a step up and we only used the classes from the oauth2lw-core we added the jdbc datasource and the token store and passed these to our configures.
Subscribe to:
Post Comments (Atom)
Istio —simple fast way to start
istio archeticture (source istio.io) I would like to share with you a sample repo to start and help you continue your jou...
-
So RecyclerView was introduced to replace List view and it's optimized to reuse existing views and so it's faster and more efficient...
-
I worked before on learning angular 2+, and made a sample functioning app that tracks calories & macros, called it ...
-
In the previous part we finished the dashboard read functionality, now we want to add the skeleton for other pages: - Login In this p...
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.