Comments (8)
You’re welcome! And it is a common use case indeed! I already thought about having a hook inside the loginUser()
(here) method to implement custom modifications to the Kirby user based on the OAuth ResourceOwner.
from kirby-oauth.
Since there is no roadmap for this plug-in I can't add it. But I think this makes the plug-in a lot more flexible this will be the next feature I'm going to implement.
If that's not fast enough for your case or someone else likes to help here: Pull requests are very welcome... 😉
from kirby-oauth.
Yeah, I guess a hook basically covers all use cases and is more flexible than hard coding specific user props. Any chance you can put the hook functionality on your roadmap?
from kirby-oauth.
What would you suggest the function signature for this hook should look like? What are its parameters?
from kirby-oauth.
I’m thinking about having a hook that gets the $oauthUser
(ResourceOwnerInterface
) as a first parameter and the second one is the Kirby user. Then you can modify the user or even implement a gate by throwing an exception to prevent the user login. I’m not sure if it should replace/bypass the whole creation and check logic currently I would say it should be an addition.
from kirby-oauth.
I’m not sure if it should replace/bypass the whole creation and check logic currently I would say it should be an addition.
Would probably be nice if this was optional – maybe a config option? Or could this somehow be conifgured/decided within the hook function? Could call the existing login logic inside the hook (if wanted)?
from kirby-oauth.
@thathoff In the last year I've learned a lot more about Oauth, and I have an upcoming project, where I need to distinguish users based on their groups
in the Identity Provider again.
I have thought about implementing this, but I'm currently a little lost regarding the PHP League Oauth Interface. The interface doesn't have any functions for getting custom claim (like groups
) from the token. So even with your suggested hook solution, we'd only have the ResourceOwnerInterface
which doesn't offer anything to access custom claims from the token.
from kirby-oauth.
This depends largely on your Oauth provider. I remember from a project that fetching the groups for a Google user is pretty hard to do. Have you tried to fetch the groups with the $provider->getAuthenticatedRequest()
method and maybe an API providing the groups of the user? (see https://oauth2-client.thephpleague.com/usage/ for an example).
from kirby-oauth.
Related Issues (19)
- Add documentation about access configuration
- Creating users does not Work with Kirby 3.5
- OAuth Button doesn't show up HOT 1
- v1.2.0 is not working with Kirby >= 3.5.0
- When logging out from Kirby the OAuth options are not added to the login screen HOT 1
- Kirby 3.6.0 Compatibility HOT 5
- Document redirect URL schema HOT 1
- Add config option for redirect target (other than /panel) HOT 5
- [BUG] Controller.php overwrites email povided by Azure in `upn`
- When the first user has been created login fails for following users
- How to use this plugin for frontend / non panel logins HOT 1
- Kirby 4 Support HOT 1
- Login without additional redirect HOT 4
- Incompatibility with Kirby 4.2.0 HOT 3
- support submodule and zip installation HOT 6
- Reimplement hackish button in Login screen with new custom login screen plugin type HOT 1
- Bug: redirectUri auto value doesn't work HOT 1
- SyntaxError: Unexpected token < in JSON at position 0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kirby-oauth.