saml icon indicating copy to clipboard operation
saml copied to clipboard

Handle error before handling session in Middleware.RequireAccount

Open ghifari160 opened this issue 7 months ago • 0 comments

m.RequireAccount checks if session is nil and only handles error when it is. When using custom implementations of SessionProvider, it is possible that the provider returns a non-nil Session when an error occurred. This pr handles the error and checks for nil Session before passing the session to the context. Also, checking for ErrNoSession is done with the standard library's errors.Is (added to the standard library in Go 1.13). This way, custom implementations of the SessionProvider interface can wrap the error if they need to provide additional context down the line.

ghifari160 avatar May 28 '25 01:05 ghifari160