mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-23 10:21:00 +00:00
SkipVerify oauth code as needed
This commit is contained in:
parent
9353befd90
commit
7c2764f8eb
1 changed files with 12 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
package github
|
package github
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/tls"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -89,7 +90,17 @@ func (g *Github) Login(res http.ResponseWriter, req *http.Request) (*model.User,
|
||||||
return nil, false, nil
|
return nil, false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var trans = &oauth2.Transport{Config: config}
|
var trans = &oauth2.Transport{
|
||||||
|
Config: config,
|
||||||
|
}
|
||||||
|
if g.SkipVerify {
|
||||||
|
trans.Transport = &http.Transport{
|
||||||
|
Proxy: http.ProxyFromEnvironment,
|
||||||
|
TLSClientConfig: &tls.Config{
|
||||||
|
InsecureSkipVerify: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
var token, err = trans.Exchange(code)
|
var token, err = trans.Exchange(code)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, fmt.Errorf("Error exchanging token. %s", err)
|
return nil, false, fmt.Errorf("Error exchanging token. %s", err)
|
||||||
|
|
Loading…
Reference in a new issue