not yet on protocol
Better control of the OmniAuth authentication flows + adding new OmniAuth strategies
Currently Decidim is somewhat "locked" to the OmniAuth strategies that it ships with as defined here:
https://git.io/Je4p5
To add new methods, you will need to override the constant which is a bad convention.
Another thing is that with certain OmniAuth strategies, we need to have the control over the callback route and possibly also of the sign out route (in order to send a sign out request to the service in question). These are not straight forward to implement in Decidim right now.
As an example, you can take a look at the Suomi.fi module we've built which is a SAML2 based authentication method:
https://github.com/mainio/decidim-module-suomifi
Here is what we need to do to add the new OmniAuth strategy in the first place:
https://git.io/Je4pF
Here is what we need to do to take control of the callback and passthru routes:
https://git.io/Je4pb
Here is what we need to do to take control of the sign out flow:
https://git.io/Je4pA
https://git.io/Je4pp
If you spend few moments investigating those pieces of code, you will notice that it's quite a hack currently to implement these. It's even worse when we have to implement multiple methods that all need e.g. individual sign out flow controls.
4 comments
-
Hello Antti,
We did have the same kind of problems on our side with OIDC and SAML connectors but we did manage to find "better" solutions for a few of them.
• Add a new Omniauth strategy :
- (optional) Create a dedicated strategy subclass based on the SSO protocol you need (eg: omniauth-decidim https://git.io/Je4jP)
Overwriting methods in this class can give you flexibility BEFORE the Session / Registrations logic in the Decidim controllers (like tweaking the IDP endpoint or returned data if the configuration are not sufficient for that)- Create a config initializer to add your new strategy like https://git.io/Je4jH
(and here is the corresponding strategy https://git.io/Je4jd)Tweaking the strategy configuration / methods can most of the times prevent you changing code in the Decidim Controllers.
SAML services could be tricky sometimes but there is a LOT of configuration that can be passed to the connector (another example of configuration for SAML : https://git.io/Je4jN)1 votes up 0 votes down-
Yes, we are doing similar things.
The custom OmniAuth strategy is provided as its own gem:
https://github.com/mainio/omniauth-suomifiThis takes care of the SAML2 flows and here we register the strategy and custom failure app for Devise/Decidim:
https://git.io/JeBeIBut it's not straight forward right now. It would be better if the framework itself would provide us ready made hooks to map the strategy to Decidim.
One interesting point from this, though, is the suggestion of handling the before/after registration logic directly through Rack. But I still think it's somewhat of a hack that way as well, I'd rather handle that within the framework (as we need to control stuff within the framework itself).
1 votes up 0 votes down
-
-
Sorry I was cut by the characters limit on my previous message ...
The other parts of you problems here seems to comes from the Verifications / Authorizations logic linked to you IDP, which is definitly an issue when the 2 are related. We do agree that this should be addressed in the upcoming roadmap for 2020 as external service connexion could be a key a better integration of Decidim in existing information system.
Anyway, we are also working around theses issues and we should have some code / features to discuss in the upcoming weeks.
1 votes up 0 votes down -
Thank you both for sharing your efforts in adding new omniauth strategies. I succesfully managed to add decidim-ldap to our system, which still has the major flaw that I had to deactivate forgery protection in order to make it work. See: ttps://git.io/JezQU and the workaround: https://git.io/JezQI
I'll keep an eye on this proposals and have a look at your commits within the next weeks.
Moreover, I agree that a simple way of adding more authorization strategies is crucial for its acceptance.
0 votes up 0 votes down
Sign in with your Atmosphere account to comment.