diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-11-28 14:30:55 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-11-28 14:30:55 +0100 |
| commit | bb760ad9036b586fd4f07b96623e8421e1dccaf0 (patch) | |
| tree | c06fa76d5fe89dadb3e7ad6d4f2c1d5fe6f94912 /internal/oauth | |
| parent | 0bfb35520d7e138e6219e550187e0b55bc8a29ac (diff) | |
Formatting: Run golines
Diffstat (limited to 'internal/oauth')
| -rw-r--r-- | internal/oauth/oauth.go | 18 | ||||
| -rw-r--r-- | internal/oauth/oauth_test.go | 5 |
2 files changed, 19 insertions, 4 deletions
diff --git a/internal/oauth/oauth.go b/internal/oauth/oauth.go index 6abdb7f..9233448 100644 --- a/internal/oauth/oauth.go +++ b/internal/oauth/oauth.go @@ -139,7 +139,10 @@ func (oauth *OAuth) AccessToken() (string, error) { // Check if refresh is even possible by doing a simple check if the refresh token is empty // This is not needed but reduces API calls to the server if tokens.refresh == "" { - return "", types.NewWrappedError(errorMessage, &TokensInvalidError{Cause: "no refresh token is present"}) + return "", types.NewWrappedError( + errorMessage, + &TokensInvalidError{Cause: "no refresh token is present"}, + ) } // Otherwise refresh and then later return the access token if we are successful @@ -366,7 +369,11 @@ func (oauth *OAuth) Callback(w http.ResponseWriter, req *http.Request) { defer func() { // writing the html is best effort if oauth.session.CallbackError != nil { - _ = writeResponseHTML(w, "Authorization Failed", "The authorization has failed. See the log file for more information.") + _ = writeResponseHTML( + w, + "Authorization Failed", + "The authorization has failed. See the log file for more information.", + ) } else { _ = writeResponseHTML(w, "Authorized", "The client has been successfully authorized. You can close this browser window.") } @@ -472,7 +479,12 @@ func (oauth *OAuth) AuthURL(name string, postProcessAuth func(string) string) (s } // Fill the struct with the necessary fields filled for the next call to getting the HTTP client - oauthSession := ExchangeSession{ClientID: name, ISS: oauth.ISS, State: state, Verifier: verifier} + oauthSession := ExchangeSession{ + ClientID: name, + ISS: oauth.ISS, + State: state, + Verifier: verifier, + } oauth.session = oauthSession // set up the listener to get the redirect URI diff --git a/internal/oauth/oauth_test.go b/internal/oauth/oauth_test.go index 2427220..693984e 100644 --- a/internal/oauth/oauth_test.go +++ b/internal/oauth/oauth_test.go @@ -14,7 +14,10 @@ func Test_verifiergen(t *testing.T) { // Verifier must be at minimum 43 and at max 128 characters... // However... Our verifier is exactly 43! if len(verifier) != 43 { - t.Fatalf("Got verifier length: %d, want a verifier with at least 43 characters", len(verifier)) + t.Fatalf( + "Got verifier length: %d, want a verifier with at least 43 characters", + len(verifier), + ) } _, unescapeErr := url.QueryUnescape(verifier) |
