HWIOAuthBundle | OAuth client integration for Symfony Supports both OAuth10a and OAuth2 | OAuth library
kandi X-RAY | HWIOAuthBundle Summary
kandi X-RAY | HWIOAuthBundle Summary
[License] The HWIOAuthBundle adds support for authenticating users via OAuth1.0a or OAuth2 in Symfony.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Loads the configuration .
- Get request token .
- Handle OAuth errors
- Add OAuth provider configuration .
- Get user information .
- Get the value for a path .
- Sets the user data .
- Create OAuth provider .
- Returns the preferred locale value .
- Configure the security provider .
HWIOAuthBundle Key Features
HWIOAuthBundle Examples and Code Snippets
Community Discussions
Trending Discussions on HWIOAuthBundle
QUESTION
I created a test application to test if SSO (Single sign on) works. I use Auth0 as a SSO provider. Symfony 4.4 as application framework. I used this article from Auth0 to create the basics. So far I can login/logout.
Problem:When I login once (with credentials), logout after and then login again I am instandly logged in with the same account I used before. Without needing to fill in credentials again. It seems to remember the session or somehow does not completely logout a user. I want the user to have to login again with credentials after it logged out. Since some of my users will use one computer for the applications (so switching user is needed).
Possible fix/Extra info:According to there docs/community I should look at this. But this seems to mean that I need API calls to add the ?federated
. Which the setup example does not use (probably the library does it for me). Also my logout function in the SecurityController that is generated by the make:auth
(or make:user
) doesn't execute the code anymore. Even if I change the function name it still logged me out. Only untill I remove/change the route name it stops. It's probably very bad but maybe if I had the chance to execute a API call when I logout I could do this API call.
The best thing I could imagine to do is change some settings in symfony or add some small piece of code to make it logout correclty. But I dont know how.
My code:SecurityController.php
...ANSWER
Answered 2021-Aug-26 at 06:58It looks like that you have to logout from the oauth service you are using, here is a similar issue.
Worked out in code:src/Security/CustomLogoutSuccessHandler.php
QUESTION
I've been running an intranet admin panel in Symfony 3.x for several years. The users login with google oauth and the system checks if the email matches a validated one in a lookup-list. The oauth client handling is done with the "HWI OAuth Bundle".
In order to start a clean way to migrate this admin panel into SF4 and later to SF5 we've started breaking our monolyth into microservices running in docker.
Moving to docker behind a reverse proxyToday we were moving this admin panel into a docker. Then we are having the public apache2
doing a ProxyPass
towards the docker running the admin panel. Let's imagine the docker runs in http://1.2.3.4:7540
Let's assume the public address is https://admin-europe.example.com
What happens is that the symfony application has a relative URL, as the route google_login
configured in the routing.yml
and in the service configuration defined in the security.yml
:
routing:
...ANSWER
Answered 2020-Jun-25 at 12:37The underlying reason is the way Symfony generated the full-addresses from a relative path or route name.
Here's the investigation:
The method
HWI/OAuthUtils::getAuthorizationUrl()
is the one that generates the OAUth auth URI and consumes the methodSymfony/HttpUtils::generateUri()
to get the absolute URI of the redirect_to callback that will be encoded inside the Auth URI.The method
Symfony/HttpUtils::generateUri()
generates an absolute URI (that in our case will be the callback) and to do so, the method handles 3 general cases:- The parameter is already an absolute URI (the return is the parameter without further processing)
- The parameter is a relative URL (the function calls the Request class to build the proto + host + port + project-path prefix to prepend to the relative URI)
- The parameter is a route name (the funcion calls the Router class to build the absolute URI)
In my example I was configuring a relative URL (google: "/login/check-google"
) in the security.yml
so HttpUtils
was delegating into the Request
class.
Looking at the source of the Request
class we observe:
- The
Request
class is able to use proxy headers to build the absolute class. - But for security, by default symfony does not trust that a proxy exists merely because there are
X-FORWARDED-*
headers in it. - Indeed it's more secure plus more flexible.
- There are 2 levels of security:
- Somewhere we need to tell the
Request
class what is the list of trusted IPs that are proxies accessing the application. - Somewhere else we need to tell the
Request
class what specific proxy headers are trusted and what headers are not, even it supports different standards headers (RFC headers, non-RFC apache headers, etc)
- Somewhere we need to tell the
Stated here https://symfony.com/blog/fixing-the-trusted-proxies-configuration-for-symfony-3-3 is that you need to configure the trusted proxies in the front-controller by calling the static method Request::setTrustedProxies();
So adding those couple of lines in the front-controller one killing non-nee4ded headers and the other with the IP ranges of the proxies, solved the problem:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install HWIOAuthBundle
[2.0](https://github.com/hwi/HWIOAuthBundle/blob/master/docs/1-setting_up_the_bundle.md) (upcoming) - with support for Symfony: ^4.4, ^5.4 & ^6.0 (PHP: ^7.4, ^8.0),
[1.4](https://github.com/hwi/HWIOAuthBundle/blob/1.4/docs/1-setting_up_the_bundle.md) (current) - with support for Symfony: ^4.4 & ^5.1 (PHP: ^7.3 & ^8.0),
1.3 (outdated) - with support for Symfony: ^4.4 and ^5.0 (PHP: ^7.2 & ^8.0).
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page