日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

SAP Spartacus 会使用 Session timeout 吗?

發(fā)布時間:2023/12/19 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SAP Spartacus 会使用 Session timeout 吗? 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

問題:Where to configure session timeout in Spartacus

答案

我假設(shè)您使用 Hybris OAuth 服務(wù)器的默認(rèn)身份驗(yàn)證流程(密碼流程)。 在這種情況下,會話長度是通過后臺的 OAuth 客戶端設(shè)置來控制的。

但是,要知道會話何時到期,您可以檢查令牌有效負(fù)載 (AuthStorageService.getToken)。屬性之一是到期時間,可用于了解會話何時實(shí)際結(jié)束。

Marcin is correct. Spartacus is 100% API driven, interacting with Commerce backend by sending request to configured endpoints. These endpoints require an access token to be sent with the request, and this access token needs to be retrieved by following the Client Credentials Flow that is defined by the OAuth specification.

As long as you log in successfully, you can find access token issued by Commerce backend in Chrome dev tools, application tab -> Local storage as highlighted below:

the field expires_at stores the value of exact date and time when token will be expired.

you can use the code below in console to convert it to human readable string:

new Date(1627660784476).toGMTString();

You can control the token time-to-live value via configuration in backoffice by property: oauth2.accessTokenValiditySeconds

See document for detail:

https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/2105/en-US/3d3ea6a4d5fa486aa324ce278fa2afc3.html?q=oauth2.accessTokenValiditySeconds

if you need to code in Spartacus to know when the token will be expired, inject AuthStorageService in your app.module.ts, and then access expires_at property of result returned by getToken method.

export class AppModule {constructor(private authService: AuthStorageService){const token: Observable<AuthToken> = this.authService.getToken();token.subscribe((token) => console.log('expire at:' , token.expires_at));} }

更多Jerry的原創(chuàng)文章,盡在:“汪子熙”:

總結(jié)

以上是生活随笔為你收集整理的SAP Spartacus 会使用 Session timeout 吗?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。