forked from Mirrors/oauth2
Remove named return values.
This commit is contained in:
parent
70bd497612
commit
4ad15bb1fc
5
jwt.go
5
jwt.go
|
@ -42,10 +42,11 @@ type JWTOptions struct {
|
||||||
|
|
||||||
// NewJWTConfig creates a new configuration with the specified options
|
// NewJWTConfig creates a new configuration with the specified options
|
||||||
// and OAuth2 provider endpoint.
|
// and OAuth2 provider endpoint.
|
||||||
func NewJWTConfig(opts *JWTOptions, aud string) (conf *JWTConfig, err error) {
|
func NewJWTConfig(opts *JWTOptions, aud string) (*JWTConfig, error) {
|
||||||
var audURL *url.URL
|
var audURL *url.URL
|
||||||
|
var err error
|
||||||
if audURL, err = url.Parse(aud); err != nil {
|
if audURL, err = url.Parse(aud); err != nil {
|
||||||
return
|
return nil, err
|
||||||
}
|
}
|
||||||
contents, err := ioutil.ReadFile(opts.PemFilename)
|
contents, err := ioutil.ReadFile(opts.PemFilename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
11
oauth2.go
11
oauth2.go
|
@ -78,19 +78,20 @@ type Options struct {
|
||||||
|
|
||||||
// NewConfig creates a generic OAuth 2.0 configuration that talks
|
// NewConfig creates a generic OAuth 2.0 configuration that talks
|
||||||
// to an OAuth 2.0 provider specified with authURL and tokenURL.
|
// to an OAuth 2.0 provider specified with authURL and tokenURL.
|
||||||
func NewConfig(opts *Options, authURL, tokenURL string) (conf *Config, err error) {
|
func NewConfig(opts *Options, authURL, tokenURL string) (*Config, error) {
|
||||||
var aURL, tURL *url.URL
|
var aURL, tURL *url.URL
|
||||||
|
var err error
|
||||||
if aURL, err = url.Parse(authURL); err != nil {
|
if aURL, err = url.Parse(authURL); err != nil {
|
||||||
return
|
return nil, err
|
||||||
}
|
}
|
||||||
if tURL, err = url.Parse(tokenURL); err != nil {
|
if tURL, err = url.Parse(tokenURL); err != nil {
|
||||||
return
|
return nil, err
|
||||||
}
|
}
|
||||||
conf = &Config{opts: opts, authURL: aURL, tokenURL: tURL}
|
conf := &Config{opts: opts, authURL: aURL, tokenURL: tURL}
|
||||||
if err = conf.validate(); err != nil {
|
if err = conf.validate(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return
|
return conf, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config represents the configuration of an OAuth 2.0 consumer client.
|
// Config represents the configuration of an OAuth 2.0 consumer client.
|
||||||
|
|
Loading…
Reference in New Issue