You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will deal with a number of changes to the authentication functions, and how authentication is used/referenced on routes. A number of parameters will also be moved around.
The Get-PodeAuthMiddleware function will ultimately be removed, but there will be something like Add-PodeAuthMiddleware for setting up global authentication on multiple route paths.
With the removal of Get-PodeAuthMiddleware it also makes wiring up multiple Auths to one route not possible. While adding multiple Get-PodeAuthMiddleware technically wouldn't work, one idea I'm considering is creating a new Merge-PodeAuth -Name -Auths[] <-All> <-One>. This will return a "merged" auth type usable on Routes, and you can either have All auths needed to pass, or just One to pass.
Another change is that New-PodeAuthType will be renamed to New-PodeAuthScheme (and its -Scheme parameter will be renamed to -Type)
Routes
Middleware
Currently when using Authentication in Routes, you need to use the Get-PodeAuthMiddleware function. This to be honest is a little clunky, and it would be nice to just say "please use this Auth on this Route".
So for this change, there'll be a new -Authentication (or just -Auth) parameter which accepts the name of the Auth:
New-PodeAuthScheme-Basic |Add-PodeAuth-Name 'Login'#etcAdd-PodeRoute-Method Get -Path '/path'-Authentication Login -ScriptBlock {}
This will automatically wire-up the authentication middleware - which will run prior to other Route middleware.
Log in/out
The next change on Routes is to remove the -AutoLogin and -Logout switches from Get-PodeAuthMiddleware and move them onto Add-PodeRoute. These will work along side the -Auth parameter, to auto-login requests, or logout.
Flash
And the final change is to remove the -EnableFlash from Get-PodeAuthMiddleware, and move onto Add-PodeRoute.
Auth
Sessions
The first change is to remove the -Sessionless switch from Get-PodeAuthMiddleware, and move it onto Add-PodeAuth - it makes more sense here anyway, as you'll either was an Auth to be generically sessionable/sessionless.
Success/Failure
The next change is to remove the -FailureUrl, -FailureMessage and -SuccessUrl parameters from Get-PodeAuthMiddleware, and move them onto Add-PodeAuth.
Global
After the above, the only thing to do is remove the Get-PodeAuthMiddleware function. This then makes setting up global auth middleware impossible, so a new Add-PodeAuthMiddleware should be created to wire-up an authentication as global middleware for multiple routes/paths.
The text was updated successfully, but these errors were encountered:
This will deal with a number of changes to the authentication functions, and how authentication is used/referenced on routes. A number of parameters will also be moved around.
The
Get-PodeAuthMiddleware
function will ultimately be removed, but there will be something likeAdd-PodeAuthMiddleware
for setting up global authentication on multiple route paths.Another change is that
New-PodeAuthType
will be renamed toNew-PodeAuthScheme
(and its-Scheme
parameter will be renamed to-Type
)Routes
Middleware
Currently when using Authentication in Routes, you need to use the
Get-PodeAuthMiddleware
function. This to be honest is a little clunky, and it would be nice to just say "please use this Auth on this Route".So for this change, there'll be a new
-Authentication
(or just-Auth
) parameter which accepts the name of the Auth:This will automatically wire-up the authentication middleware - which will run prior to other Route middleware.
Log in/out
The next change on Routes is to remove the
-AutoLogin
and-Logout
switches fromGet-PodeAuthMiddleware
and move them ontoAdd-PodeRoute
. These will work along side the-Auth
parameter, to auto-login requests, or logout.Flash
And the final change is to remove the
-EnableFlash
fromGet-PodeAuthMiddleware
, and move ontoAdd-PodeRoute
.Auth
Sessions
The first change is to remove the
-Sessionless
switch fromGet-PodeAuthMiddleware
, and move it ontoAdd-PodeAuth
- it makes more sense here anyway, as you'll either was an Auth to be generically sessionable/sessionless.Success/Failure
The next change is to remove the
-FailureUrl
,-FailureMessage
and-SuccessUrl
parameters fromGet-PodeAuthMiddleware
, and move them ontoAdd-PodeAuth
.Global
After the above, the only thing to do is remove the
Get-PodeAuthMiddleware
function. This then makes setting up global auth middleware impossible, so a newAdd-PodeAuthMiddleware
should be created to wire-up an authentication as global middleware for multiple routes/paths.The text was updated successfully, but these errors were encountered: