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:
parent
4d85b23e8a
commit
6f6f2e6fd7
@ -143,16 +143,16 @@ func (o *OAuth2) Start(w http.ResponseWriter, r *http.Request) error {
|
|||||||
authboss.DelSession(w, authboss.SessionOAuth2Params)
|
authboss.DelSession(w, authboss.SessionOAuth2Params)
|
||||||
}
|
}
|
||||||
|
|
||||||
url := cfg.OAuth2Config.AuthCodeURL(state)
|
authCodeUrl := cfg.OAuth2Config.AuthCodeURL(state)
|
||||||
|
|
||||||
extraParams := cfg.AdditionalParams.Encode()
|
extraParams := cfg.AdditionalParams.Encode()
|
||||||
if len(extraParams) > 0 {
|
if len(extraParams) > 0 {
|
||||||
url = fmt.Sprintf("%s&%s", url, extraParams)
|
authCodeUrl = fmt.Sprintf("%s&%s", authCodeUrl, extraParams)
|
||||||
}
|
}
|
||||||
|
|
||||||
ro := authboss.RedirectOptions{
|
ro := authboss.RedirectOptions{
|
||||||
Code: http.StatusTemporaryRedirect,
|
Code: http.StatusTemporaryRedirect,
|
||||||
RedirectPath: url,
|
RedirectPath: authCodeUrl,
|
||||||
}
|
}
|
||||||
return o.Authboss.Core.Redirector.Redirect(w, r, ro)
|
return o.Authboss.Core.Redirector.Redirect(w, r, ro)
|
||||||
}
|
}
|
||||||
|
@ -131,11 +131,11 @@ func TestStart(t *testing.T) {
|
|||||||
t.Error("code was wrong:", h.redirector.Options.Code)
|
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 {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
query := url.Query()
|
query := redirectPathUrl.Query()
|
||||||
if state := query.Get("state"); len(state) == 0 {
|
if state := query.Get("state"); len(state) == 0 {
|
||||||
t.Error("our nonce should have been here")
|
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" {
|
if clientID := query.Get("client_id"); clientID != "jazz" {
|
||||||
t.Error("clientID was wrong:", clientID)
|
t.Error("clientID was wrong:", clientID)
|
||||||
}
|
}
|
||||||
if url.Host != "accounts.google.com" {
|
if redirectPathUrl.Host != "accounts.google.com" {
|
||||||
t.Error("host was wrong:", url.Host)
|
t.Error("host was wrong:", redirectPathUrl.Host)
|
||||||
}
|
}
|
||||||
|
|
||||||
if h.session.ClientValues[authboss.SessionOAuth2State] != query.Get("state") {
|
if h.session.ClientValues[authboss.SessionOAuth2State] != query.Get("state") {
|
||||||
|
@ -28,8 +28,8 @@ func TestTOTPSetup(t *testing.T) {
|
|||||||
ab.Config.Core.ViewRenderer = renderer
|
ab.Config.Core.ViewRenderer = renderer
|
||||||
ab.Config.Core.ErrorHandler = errHandler
|
ab.Config.Core.ErrorHandler = errHandler
|
||||||
|
|
||||||
totp := &TOTP{Authboss: ab}
|
totpNew := &TOTP{Authboss: ab}
|
||||||
if err := totp.Setup(); err != nil {
|
if err := totpNew.Setup(); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 {
|
func (r *Recover) invalidToken(page string, w http.ResponseWriter, req *http.Request) error {
|
||||||
errors := []error{errors.New("recovery token is invalid")}
|
errorsAll := []error{errors.New("recovery token is invalid")}
|
||||||
data := authboss.HTMLData{authboss.DataValidation: authboss.ErrorMap(errors)}
|
data := authboss.HTMLData{authboss.DataValidation: authboss.ErrorMap(errorsAll)}
|
||||||
return r.Authboss.Core.Responder.Respond(w, req, http.StatusOK, PageRecoverEnd, data)
|
return r.Authboss.Core.Responder.Respond(w, req, http.StatusOK, PageRecoverEnd, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user