我想把我的angular2前端应用程序和symfony后端连接起来。因此,我使用FOSOAuthServerBundle (https://github.com/FriendsOfSymfony/FOSOAuthServerBundle)来授权我的前端应用程序,但我不清楚如何实现它。
什么是最佳实践授权使用symfony的angular2?把client_secret存储在前端可以吗?还是应该扩展FOSOAuthServerBundle并删除client_secret检查?
发布于 2017-03-20 08:10:10
你对client_secret的看法是正确的。更广泛地公开秘密密钥是不正确的做法。
不幸的是,目前FOSOAuthBundle并不适合您的需要。这个包只关注后端OAuth客户端。他们在github上有一个公开的问题来增加对公共客户端的支持:https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/issues/266
关于令牌有一件事要澄清&授权端点-令牌和授权端点必须在访问资源的过程中混合。我建议您阅读整个RFC以了解OAuth:https://www.rfc-editor.org/rfc/rfc6749的授权过程。
发布于 2019-06-06 13:46:05
Hacky解决方案:在src/Entity/OAuth2/Client.php中,您可以像这样覆盖checkSecret方法:
public function checkSecret($secret)
{
if (in_array("authorization_code", $this->getAllowedGrantTypes())) {
return true;
}
return parent::checkSecret($secret);
}https://stackoverflow.com/questions/42898137
复制相似问题