Skip to content

Commit

Permalink
Add with login url.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishalbert committed Jan 16, 2024
1 parent a860885 commit be30822
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions google/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ func GetLoginURL(state string) string {
return conf.AuthCodeURL(state)
}

func WithLoginURL(url string) {
loginURL = url
}

// Auth is the google authorization middleware. You can use them to protect a routergroup.
// Example:
//
Expand Down
10 changes: 10 additions & 0 deletions google/google_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,13 @@ func TestSetupFromString(t *testing.T) {
assert.Equal(t, conf.ClientSecret, "clientsecret")
})
}

func TestWithLoginURL(t *testing.T) {
t.Run("should assign the login url", func(t *testing.T) {
loginURL = ""
url := "http://fake.fake"
WithLoginURL(url)
assert.NotEmpty(t, url)
assert.Equal(t, url, loginURL)
})
}

0 comments on commit be30822

Please sign in to comment.