fmt: code style (#518)
This commit is contained in:
parent
39368d511a
commit
6550223ee4
|
|
@ -147,9 +147,9 @@ type AuthLocalUsersConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type LocalUser struct {
|
type LocalUser struct {
|
||||||
Username string
|
Username string
|
||||||
Usergroup string
|
Usergroup string
|
||||||
Password string
|
Password string
|
||||||
}
|
}
|
||||||
|
|
||||||
type OAuth2Provider struct {
|
type OAuth2Provider struct {
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/OliveTin/OliveTin/internal/config"
|
"github.com/OliveTin/OliveTin/internal/config"
|
||||||
|
"github.com/google/uuid"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ import (
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -169,8 +169,8 @@ func checkOAuthCallbackCookie(w http.ResponseWriter, r *http.Request) (*oauth2St
|
||||||
}
|
}
|
||||||
|
|
||||||
type HttpClientSettings struct {
|
type HttpClientSettings struct {
|
||||||
Transport *http.Transport
|
Transport *http.Transport
|
||||||
Timeout time.Duration
|
Timeout time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
func getOAuth2HttpClient(providerConfig *config.OAuth2Provider) *HttpClientSettings {
|
func getOAuth2HttpClient(providerConfig *config.OAuth2Provider) *HttpClientSettings {
|
||||||
|
|
@ -178,7 +178,7 @@ func getOAuth2HttpClient(providerConfig *config.OAuth2Provider) *HttpClientSetti
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: providerConfig.InsecureSkipVerify},
|
TLSClientConfig: &tls.Config{InsecureSkipVerify: providerConfig.InsecureSkipVerify},
|
||||||
},
|
},
|
||||||
Timeout: time.Duration(min(3, providerConfig.CallbackTimeout)) * time.Second,
|
Timeout: time.Duration(min(3, providerConfig.CallbackTimeout)) * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
if providerConfig.CertBundlePath != "" {
|
if providerConfig.CertBundlePath != "" {
|
||||||
|
|
@ -228,7 +228,7 @@ func handleOAuthCallback(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
exchangeClient := &http.Client{
|
exchangeClient := &http.Client{
|
||||||
Transport: clientSettings.Transport,
|
Transport: clientSettings.Transport,
|
||||||
Timeout: clientSettings.Timeout,
|
Timeout: clientSettings.Timeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
@ -245,7 +245,7 @@ func handleOAuthCallback(w http.ResponseWriter, r *http.Request) {
|
||||||
userInfoClient := &http.Client{
|
userInfoClient := &http.Client{
|
||||||
Transport: &oauth2.Transport{
|
Transport: &oauth2.Transport{
|
||||||
Source: registeredState.providerConfig.TokenSource(ctx, tok),
|
Source: registeredState.providerConfig.TokenSource(ctx, tok),
|
||||||
Base: clientSettings.Transport,
|
Base: clientSettings.Transport,
|
||||||
},
|
},
|
||||||
Timeout: clientSettings.Timeout,
|
Timeout: clientSettings.Timeout,
|
||||||
}
|
}
|
||||||
|
|
@ -270,7 +270,7 @@ func handleOAuthCallback(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserInfo struct {
|
type UserInfo struct {
|
||||||
Username string
|
Username string
|
||||||
Usergroup string
|
Usergroup string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue