1
0
mirror of https://github.com/volatiletech/authboss.git synced 2025-01-22 05:09:42 +02:00

Imported pkg name as name identifier

This commit is contained in:
frederikhors 2020-01-29 14:52:00 +01:00
parent 4d85b23e8a
commit 6f6f2e6fd7
4 changed files with 11 additions and 11 deletions

View File

@ -143,16 +143,16 @@ func (o *OAuth2) Start(w http.ResponseWriter, r *http.Request) error {
authboss.DelSession(w, authboss.SessionOAuth2Params)
}
url := cfg.OAuth2Config.AuthCodeURL(state)
authCodeUrl := cfg.OAuth2Config.AuthCodeURL(state)
extraParams := cfg.AdditionalParams.Encode()
if len(extraParams) > 0 {
url = fmt.Sprintf("%s&%s", url, extraParams)
authCodeUrl = fmt.Sprintf("%s&%s", authCodeUrl, extraParams)
}
ro := authboss.RedirectOptions{
Code: http.StatusTemporaryRedirect,
RedirectPath: url,
RedirectPath: authCodeUrl,
}
return o.Authboss.Core.Redirector.Redirect(w, r, ro)
}

View File

@ -131,11 +131,11 @@ func TestStart(t *testing.T) {
t.Error("code was wrong:", h.redirector.Options.Code)
}
url, err := url.Parse(h.redirector.Options.RedirectPath)
redirectPathUrl, err := url.Parse(h.redirector.Options.RedirectPath)
if err != nil {
t.Fatal(err)
}
query := url.Query()
query := redirectPathUrl.Query()
if state := query.Get("state"); len(state) == 0 {
t.Error("our nonce should have been here")
}
@ -145,8 +145,8 @@ func TestStart(t *testing.T) {
if clientID := query.Get("client_id"); clientID != "jazz" {
t.Error("clientID was wrong:", clientID)
}
if url.Host != "accounts.google.com" {
t.Error("host was wrong:", url.Host)
if redirectPathUrl.Host != "accounts.google.com" {
t.Error("host was wrong:", redirectPathUrl.Host)
}
if h.session.ClientValues[authboss.SessionOAuth2State] != query.Get("state") {

View File

@ -28,8 +28,8 @@ func TestTOTPSetup(t *testing.T) {
ab.Config.Core.ViewRenderer = renderer
ab.Config.Core.ErrorHandler = errHandler
totp := &TOTP{Authboss: ab}
if err := totp.Setup(); err != nil {
totpNew := &TOTP{Authboss: ab}
if err := totpNew.Setup(); err != nil {
t.Fatal(err)
}

View File

@ -271,8 +271,8 @@ func (r *Recover) EndPost(w http.ResponseWriter, req *http.Request) error {
}
func (r *Recover) invalidToken(page string, w http.ResponseWriter, req *http.Request) error {
errors := []error{errors.New("recovery token is invalid")}
data := authboss.HTMLData{authboss.DataValidation: authboss.ErrorMap(errors)}
errorsAll := []error{errors.New("recovery token is invalid")}
data := authboss.HTMLData{authboss.DataValidation: authboss.ErrorMap(errorsAll)}
return r.Authboss.Core.Responder.Respond(w, req, http.StatusOK, PageRecoverEnd, data)
}