← history for webauth.go
fe12c3fbwebauth.go20 lines⬡ raw↓ download
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
package main

import "github.com/AaronO/go-git-http/auth"

func AuthorizeGitRequest(authInfo auth.AuthInfo) (bool, error) {
    if authInfo.Push {
        return false, nil
    }

    // Typically this would be a database lookup
    if authInfo.Username == "admin" && authInfo.Password == "password" {
        return true, nil
    }

    return false, nil
}

func AuthorizeAllGitRequests(authInfo auth.AuthInfo) (bool, error) {
    return true, nil
}