auth

Paddy 2014-12-14 Parent:e57a57a944c4 Child:c03b5eb3179e

102:267483f168b5 Go to Latest

auth/context.go

Require config.Init in Context, add comment. Add comment to config.Init explaining what it is, to make golint happy. Create an ErrConfigNotInitialized error to use when a Config object is used to create a Context before it is initialized. Check for Config initialization in NewContext and throw ErrConfigNotInitialized if the Config hasn't been initialized.

History
     1.1 --- a/context.go	Sun Dec 14 16:23:10 2014 -0500
     1.2 +++ b/context.go	Sun Dec 14 16:49:34 2014 -0500
     1.3 @@ -27,6 +27,9 @@
     1.4  // NewContext takes a Config instance and uses it to bootstrap a Context
     1.5  // using the information provided in the Config variable.
     1.6  func NewContext(config Config) (Context, error) {
     1.7 +	if config.iterations == 0 {
     1.8 +		return Context{}, ErrConfigNotInitialized
     1.9 +	}
    1.10  	context := Context{
    1.11  		clients:   config.ClientStore,
    1.12  		authCodes: config.AuthCodeStore,