- OAuth 2.0 Cookbook
- Adolfo Eloy Nascimento
- 169字
- 2021-07-08 09:35:04
There's more...
For this recipe, we didn't create any configuration class. But if you want to define the base URL for callback redirection that happens when using the OAuth 2.0 protocol, you need to create a configuration class to define a custom ConnectController bean, as presented in the following code:
@Configuration public class LinkedInConfiguration { @Bean public ConnectController connectController(ConnectionFactoryLocator locator, ConnectionRepository repository) { ConnectController controller = new ConnectController(locator, repository); controller.setApplicationUrl("http://localhost:8080"); return controller; } }
By doing such configurations, you avoid issues when the application runs behind a proxy. The redirect URI will be automatically generated using the request info which will be based on the application which might be running behind a proxy. This way, the OAuth 2.0 Provider won't be able to redirect to the right callback URL because it will be hidden by the proxy. The configuration presented previously allows you to define the proxy's URL.
Do not forget to define the same redirect URL at the OAuth 2.0 Provider and make all the communication through TLS/SSL.
- Vue.js 3.x快速入門
- 解構(gòu)產(chǎn)品經(jīng)理:互聯(lián)網(wǎng)產(chǎn)品策劃入門寶典
- 數(shù)據(jù)結(jié)構(gòu)和算法基礎(chǔ)(Java語(yǔ)言實(shí)現(xiàn))
- 少年輕松趣編程:用Scratch創(chuàng)作自己的小游戲
- FFmpeg入門詳解:音視頻流媒體播放器原理及應(yīng)用
- Java加密與解密的藝術(shù)(第2版)
- Hands-On JavaScript High Performance
- Learn Swift by Building Applications
- Java持續(xù)交付
- 差分進(jìn)化算法及其高維多目標(biāo)優(yōu)化應(yīng)用
- “笨辦法”學(xué)C語(yǔ)言
- Android移動(dòng)開(kāi)發(fā)案例教程:基于Android Studio開(kāi)發(fā)環(huán)境
- 監(jiān)控的藝術(shù):云原生時(shí)代的監(jiān)控框架
- Ext JS 4 Plugin and Extension Development
- WCF技術(shù)剖析(卷1)