Skip to content
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

Auth interface return error when verify failure (#22119) #22259

Merged
merged 2 commits into from
Dec 29, 2022

Commits on Dec 28, 2022

  1. refactor auth interface to return error when verify failure (go-gitea…

    …#22119)
    
    This PR changed the Auth interface signature from 
    `Verify(http *http.Request, w http.ResponseWriter, store DataStore, sess
    SessionStore) *user_model.User`
    to 
    `Verify(http *http.Request, w http.ResponseWriter, store DataStore, sess
    SessionStore) (*user_model.User, error)`.
    
    There is a new return argument `error` which means the verification
    condition matched but verify process failed, we should stop the auth
    process.
    
    Before this PR, when return a `nil` user, we don't know the reason why
    it returned `nil`. If the match condition is not satisfied or it
    verified failure? For these two different results, we should have
    different handler. If the match condition is not satisfied, we should
    try next auth method and if there is no more auth method, it's an
    anonymous user. If the condition matched but verify failed, the auth
    process should be stop and return immediately.
    
    This will fix go-gitea#20563
    
    Co-authored-by: KN4CK3R <[email protected]>
    Co-authored-by: Jason Song <[email protected]>
    3 people committed Dec 28, 2022
    Configuration menu
    Copy the full SHA
    f4edc75 View commit details
    Browse the repository at this point in the history

Commits on Dec 29, 2022

  1. Configuration menu
    Copy the full SHA
    d1ee3d4 View commit details
    Browse the repository at this point in the history