angel3_auth 10.1.0
angel3_auth: ^10.1.0 copied to clipboard
A complete authentication plugin for Angel3. Includes support for stateless JWT tokens, Basic Auth, and more.
Change Log #
10.1.0 #
New in 10.1.0 #
- Documents:
requireAuthenticationis tagged with aSecurityRequirementofangel3_framework10.2.0, which this version requires, of aBearerJWT and a 403, andforceBasicAuthwith one of aBearerJWT or Basic authentication and a 401, so thatangel3_openapidocuments the security of the routes they protect
10.0.2 #
Fixes in 10.0.2 #
- Docs: The README is rewritten in plain English, with sections on trying several strategies, what a login answers, protecting routes and logging out. Its strategy list sample named a
basicstrategy that was never registered, and its popup sample used an undefinedauthOptions; both now work
10.0.1 #
Breaking changes in 10.0.1 #
- Breaking: JWTs are issued with
"iss": "angel3_auth", where it was"angel_auth". JWTs issued before are still accepted, asissis not checked; update code of your own that checks it - Breaking: The default realm of
forceBasicAuthisangel3_auth, as documented, where it sentangel_auth; browsers that remembered Basic credentials for the old realm ask for them once more. Passrealm: 'angel_auth'to keep it
Fixes in 10.0.1 #
- Logout: Once
logoutredirects tosuccessRedirect, no handler after it runs - Local strategy: Without valid credentials, of the form, it returns
null, where it threw a 401 or redirected tofailureRedirectitself, so thatauthenticatetries the next strategy of a list, as documented; of the last,authenticateanswers the 401, or redirects to itsfailureRedirectwith a 302, which browsers follow, where it was a 401. Invalid Basic credentials, andforceBasic, still answer a 401 with a Basic challenge authenticate: No strategy runs after one that has answered the request, which wrote to the closed response. The JSON answer of a login no longer serializes the user twiceonLogin: Told of every new login once it is accepted, however it is answered, as by a redirect or a callback, where it was only of one answered with JSON; not of a login thattokenCallbackrefuses, nor of a user who is signed in already. With oneAngelAuthconfigured on several apps,onLoginandonLogoutclose once the last of them shuts down, where the first one closed them for all; a login or logout after that, as of an instance configured again on a new app, is not an error, and the dropped event is warned about once- Basic authentication:
forceBasicAuthsends itsWWW-Authenticate: Basicchallenge, a 401, to a request of no JWT, where it was a 403 onceAngelAuthwas configured; a JWT that is not valid, as one that has expired, is still a 403 requireAuthentication: Called withthrowError: false, it returnsfalsefor a request of no JWT, where it threw a 403loginandloginById: A user that does not exist is a 403, where it was logged in asnull.logintrusts its token, which the caller must have verified, as byAuthToken.validate. A request whose user is known already keeps that user; the new one is of the next requestconfigureServer: Configuring an app again with the same instance does nothing, where it threw aStateError; another instance of the same user type still throwsExternalAuthOptions:==comparesclientSecretandredirectUri, which it compared with themselves- Popup page:
confirmPopupAuthenticationescapes<in its script, so aneventNameof</script>cannot end it
10.0.0 #
Breaking changes in 10.0.0 #
- Breaking:
POST /auth/tokenno longer revives expired JWTs, which made a stolen JWT valid for ever. It renews a valid one, or one expired within the newreviveGracePeriod(default: none), whose user still exists - Breaking:
jwtLifeSpandefaults to one day (AngelAuth.defaultJwtLifeSpan);-1(never expire) is warned about with a fixedjwtKey - Breaking: The
tokencookie isSameSite=Lax(the newcookieSameSite), against CSRF, and is set only when a user logs in or a JWT is revived, not forBearerrequests - Breaking:
allowTokenInQuerydefaults tofalse; enable it for the browser WebSocket client ofangel3_websocket - Breaking: JWTs have standard
iatandexpclaims, in seconds; JWTs issued before are still read
Fixes in 10.0.0 #
- Logout: Expires the
tokencookie, instead of setting it to"" - JWTs: Signatures are compared in constant time, a malformed JWT is a 401 instead of a server error, and a JWT without an IP keeps none.
Beareris matched whole and in any case - Local strategy: With
allowBasic, form logins work too; a malformed Basic header is a 400, and credentials are read as UTF-8 - Streams:
onLoginandonLogoutare broadcast streams, so logins are not kept in memory, and both close on shutdown authenticate: Returns once a strategy has answered the request itself, instead of throwing 401- Key: The default
jwtKeyis of random characters, not control characters - Tests: No longer use
MirrorsReflector;AngelAuthneeds no reflection - Docs: The README tells how to install and use the package, and how to migrate from 9.x
9.1.0 #
- Require Dart >= 3.13
9.0.0 #
- Require Dart >= 3.12
8.4.0 #
- Require Dart >= 3.8
- Updated
lintsto 6.0.0 - Updated dependencies to the latest release
8.3.0 #
- Require Dart >= 3.6
- Updated
lintsto 5.0.0 - Updated dependencies to the latest release
8.2.0 #
- Require Dart >= 3.3
- Updated
lintsto 4.0.0
8.1.1 #
- Updated repository link
8.1.0 #
- Updated
lintsto 3.0.0
8.0.0 #
- Require Dart >= 3.0
- Upgraded
httpto 1.0.0 - Fixed failed
successRedirecttest case - Fixed failed
failureRedirecttest case - Fixed failed
logintest case - Fixed failed
force basictest case - Added
example1andexample2
7.0.1 #
- Fixed linter warnings
7.0.0 #
- Require Dart >= 2.17
6.0.0 #
- Require Dart >= 2.16
5.0.0 #
- Skipped release
4.1.2 #
- Fixed
requireAuthenticationto work correctly with null-safety type
4.1.1 #
- Changed
userIdfield ofAuthTokento String type - Changed
serializerreturn value to String type - Changed
deserializerinput parameter to String type
4.1.0 #
- Updated linter to
package:lints
4.0.5 #
- Added support for verifier function to return an empty Map instead of null
- Fixed
canRespondWithJsonoption to return data in the response body when set to true
4.0.4 #
- Changed
serializeranddeserializerparameters to be required - Fixed HTTP basic authentication
- All 31 unit tests passed
4.0.3 #
- Fixed "failureRedirect" unit test
4.0.2 #
- Added MirrorsReflector to unit test
4.0.1 #
- Updated README
4.0.0 #
- Migrated to support Dart >= 2.12 NNBD
3.0.0 #
- Migrated to work with Dart >= 2.12 Non NNBD
2.1.5+1 #
- Fix error in popup page.
2.1.5 #
- Modify
_applyto honor an existingUseroverFuture<User>.
2.1.4 #
- Deprecate
decodeJwt, in favor of asynchronous injections.
2.1.3 #
- Use
awaiton redirects, etc.
2.1.2 #
- Change empty cookie string to have double quotes (thanks @korsvanloon).
2.1.1 #
- Added
scopestoExternalAuthOptions.
2.1.0 #
- Added
ExternalAuthOptions.
2.0.4 #
successRedirectwas previously explicitly returning a200; remove this and allow the default302.
2.0.3 #
- Updates for streaming parse of request bodies.
2.0.2 #
- Handle
nullreturn inauthenticate+failureRedirect.
2.0.1 #
- Add generic parameter to
optionsonAuthStrategy.authenticate.
2.0.0+1 #
- Meta update to improve Pub score.
2.0.0 #
- Made
AuthStrategygeneric. AngelAuth.strategiesis now aMap<String, AuthStrategy<User>>.- Removed
AuthStrategy.canLogout. - Made
AngelAuthTokenCallbackgeneric.
2.0.0-alpha #
- Depend on Dart 2 and Angel 2.
- Remove
dart2_constant. - Remove
requireAuth. - Remove
userKey, instead favoring generic parameters.
1.2.0 #
- Deprecate
requireAuth, in favor ofrequireAuthentication. - Allow configuring of the
userKey. - Deprecate
middlewareName.
1.1.1+6 #
- Fix a small logic bug that prevented
LocalAuthStrategyfrom correctly propagating the authenticated user when usingBasicauth.
1.1.1+5 #
- Prevent duplication of cookies.
- Regenerate the JWT if
tokenCallbackis called.
1.1.1+4 #
- Patched
logoutto properly erase cookies - Fixed checking of expired tokens.
1.1.1+3 #
authenticatereturns the current user, if one is present.
1.1.1+2 #
_applynow always sends atokencookie.
1.1.1+1 #
- Update
protectCookieto only sendmaxAgewhen it is not-1.
1.1.1 #
- Added
protectCookie, to better protect data sent in cookies.
1.1.0+2 #
LocalAuthStrategyreturnstrueonBasicauthentication.
1.1.0+1 #
- Modified
LocalAuthStrategy's handling ofBasicauthentication.