-
Notifications
You must be signed in to change notification settings - Fork 7
feat: migrate from custom OpenID implementation to oidc library with security fixes #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
feat: migrate from custom OpenID implementation to oidc library with security fixes #24
Conversation
This PR migrates the authentication system from the custom OpenID Connect implementation to the well-maintained oidc library, addressing several security and maintainability concerns. Key changes: - Replace custom OpenID client with oidc library for better security - Add reactive authentication state management with ValueNotifier - Implement proper DPoP token handling through oidc hooks - Refactor example app to demonstrate new authentication patterns - Add client-profile.jsonld for Solid OIDC compliance - Update dependencies and remove unnused packages Breaking changes: - New SolidAuth class replaces previous authenticate() function - Authentication state is now reactive via isAuthenticatedNotifier - DPoP token generation integrated into authentication flow This migration improves security, reduces maintenance burden, and provides a more modern Flutter-friendly API while maintaining full Solid OIDC compatibility. The changes have been tested with the example application. Resolves authentication reliability issues and provides a foundation for future enhancements to the library.
| dart pub add solid_auth | ||
| ``` | ||
|
|
||
| ### 2. Create Your Client Profile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should discuss the options available in general for OIDC client identification (like preregistering and dynamic registration) and why only the client profile approach is suitable for flutter solid apps? Maybe as a separate markdown document?
|
|
||
| --- | ||
|
|
||
| ## Roadmap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should rather call this section "Limitations"
| --- | ||
|
|
||
| ## Roadmap | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And do you think we should also discuss here that the solid specifications for authorizing applications are still in the works and once authorization flow like in https://solid.github.io/data-interoperability-panel/specification/ is available in Solid Server implementations, we want to support it? Currently usually the pod servers give an authenticated application (like our example) full access to the entire pod - I think that it would be valuable for users of solid_auth to be aware of this and that it is a problem in the solid ecosystem on which people are working.
| **Future Goal**: Enable fully offline-first applications that can start and function without network connectivity, using cached authentication data and provider configurations. | ||
|
|
||
| This is essential for truly offline-capable Solid applications, but requires careful consideration of security trade-offs and cache management strategies. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw, that there currently is another limitation: apparently, token refresh is not fully working. Leaving the tab of my solid_task app open, after some time (an hour or so) I saw synchronization errors due to the access token not being available. Starting the app today shows me that I am logged out again - so the persistence of the login data seems to be limited. Do you think we should document this here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the reason - I have to send a certain promt, which I now do. So this is now fixed.
|
Another thought I had: If you prefer to be able to switch between the old solid-oidc implementation and the new, bdaya-dev/oidc based one, I could revert the part where I delete the embedded code, convert SolidAuth to be an abstract class with factory constructors and provide an implementation of this interface based on the original code base, as well as one based on the new one. So you could switch projects to the new API without changing the underlying implementation first, and then update to the new implementation in a second step. |
… offline_access Previously, Solid OIDC authentication failed to obtain refresh tokens because the required 'consent' prompt wasn't sent to identity providers. This change automatically adds the consent prompt when offline_access is in the requested scopes, enabling proper token refresh and persistent authentication. Includes configurable prompt calculation and comprehensive test coverage.
- Change default value of strictJwtVerification from false to true - Update documentation to reflect security-first approach - Add security warnings for disabling strict verification - Remove redundant examples showing explicit true value
During refresh, apparently we do not have headers on the request, so we need to set it to an empty map
Added required network permissions documentation to README: - Android: INTERNET permission in AndroidManifest.xml - macOS: com.apple.security.network.client entitlement These permissions are essential for Solid authentication to work properly when connecting to identity providers and pod servers. Co-Authored-By: Claude <noreply@anthropic.com>
Thanks a lot for your groundwork on supporting solid OIDC on Flutter! Like we discussed per email and Signal, I looked into updating the project to make use of the oidc package. I am sorry that it ended up to be such a huge API change, but on the upside this brings some additional features like session restoration. I hope you are fine with this.
🚀 Overview
This PR migrates the solid_auth library from its embedded copy of
openid_clientto the modernoidcpackage, primarily to gain RFC 8252 (OAuth 2.0 for Native Apps) compliance, while also addressing security vulnerabilities and significantly improving the developer experience.✨ Key Improvements
🔒 Security Enhancements
oidclibrary which implements RFC 8252 (OAuth 2.0 for Native Apps) security best practicesopenid_clientwith actively maintainedoidcv0.12.1+2📱 New Developer Experience Features
ValueListenable-based authentication state updates for reactive UISolidAuthAPI replacing function-based approach📚 Comprehensive Documentation
🔄 Breaking Changes
API Changes
SolidAuth()constructor replaces previous function-based APIauthenticate()method with reactive state managementgenDpopToken()with simplified signatureinit(),logout(), anddispose()lifecycle methodsConfiguration Changes
openid,webid,offline_access)📋 Migration Guide
Before (Previous API)
After (New API)
🧪 Testing
📦 Dependencies
Added
oidc: ^0.12.1+2- Modern, maintained OpenID Connect libraryoidc_default_store: ^0.2.1- Secure token storage implementationRemoved
openid_clientcode - Replaced with maintained external dependencyPreserved
dart_jsonwebtoken- Still embedded🔗 Documentation Improvements
🚦 Deployment
🎯 Limitations / Future Considerations
There are some topics not addressed in this PR that we probably want to look at in the future:
Note: This migration updates the authentication stack to use RFC 8252 compliant dependencies. The new API provides reactive state management and comprehensive documentation. Breaking changes enable RFC 8252 compliance and establish a foundation for future development.