0
我想創建一個RESTful API,我需要它是無狀態的,因爲我可能會啓動N次應用程序。創建會話時無狀態使用情況水平縮放
我還添加了OAuth2和JDBC實現,用戶必須登錄一次,所有的查詢應該是無狀態的。
在我的春季啓動應用程序中添加以下內容會導致它嘗試登錄,現在嘗試兩次進行身份驗證。
http
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS);
而在服務器端我有這些日誌:
AuditEvent [timestamp=Tue Oct 04 05:04:52 ICT 2016, principal=dka, type=AUTHENTICATION_SUCCESS, data={details=org.sprin[email protected]b364: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: null}]
AuditEvent [timestamp=Tue Oct 04 05:04:52 ICT 2016, principal=anonymousUser, type=AUTHORIZATION_FAILURE, data={details=org.sprin[email protected]b364: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: null, type=org.springframework.security.access.AccessDeniedException, message=Access is denied}]
- 這是否關心我的OAuth認證以及或僅WebSecurity一部分?
- 是否有一種很好的方式來配置我的會話,以擴展它並保持服務無狀態?