-



Download 8,6 Mb.
Pdf ko'rish
bet8/37
Sana18.01.2022
Hajmi8,6 Mb.
#383795
1   ...   4   5   6   7   8   9   10   11   ...   37
Bog'liq
Designing Applications with Spring Boot 2.2 and React JS Step-by-step guide to design and develop intuitive full stack web applications by Dinesh Rajput (z-lib.org)

*
OAuth Config
*
security.oauth2.resource.user-info-uri= http://localhost:8282/prodos
auth
srvr/user
Here, we are not going to discuss each class of the resource server application. You can find the complete source code of the Resource Server
application from GitHub at https://github.com/dineshonjava/bpb-spring-boot-reactjs .
Let’s test our OAuth2 application to secure our REST APIs. First, run the authorization server application. Then, generate the tokens. We will use
the Postman and make a POST request at http://localhost:8282/prodos
auth
srvr/oauth/token . Let’s take a look at the following screenshot:
Figure 5.16: Generating tokens
As you can see in the preceding screenshot, we selected basic Auth and provided the username and password as dineshonjava and encoded the
secret client key. Also, we provided the other parameters such as the username, password, and grant type. After sending the POST request, this
will result in access
token, token
type, refresh_ token, expiry, and so on.
Now, you can use the generated access token to consume the protected REST API on the resource server application as shown in the following
screenshot:


Figure 5.17: Using access tokens to consume protect the resource from the Resource Server
As you can see in the preceding screenshot, we used the generated access token with a GET request to the resource server to fetch a protected
resource. We set the access token in the header as a Bearer token.
Implementing the client-server application
We will now implement a Prodos Client-Server application. This application will consume REST APIs hosted at the resource server application. The
client application will send the access token to access the protected resource end points. Let’s see the following project structure for the client
server application:
Figure 5.18: The client application structure
Let’s see the application configuration file of the client application:


server.servlet.context-path=/prodosapp
server.port=9000
spring.thymeleaf.cache=false

Download 8,6 Mb.

Do'stlaringiz bilan baham:
1   ...   4   5   6   7   8   9   10   11   ...   37




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©www.hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish