auth
2014-12-14
Child:e98d19699ee9
auth/config.go
Introduce Config and NewContext. Config is an exported struct that configures the program. It holds all the values that a Context needs. NewContext takes a Config object and builds a Context out of it.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/config.go Sun Dec 14 11:59:46 2014 -0500 1.3 @@ -0,0 +1,24 @@ 1.4 +package auth 1.5 + 1.6 +import ( 1.7 + "errors" 1.8 + "html/template" 1.9 +) 1.10 + 1.11 +var ( 1.12 + // ErrInvalidLoginURI is returned when a Context is instantiated with a Config object that specifies a LoginURI that can't be parsed as a URL. 1.13 + ErrInvalidLoginURI = errors.New("invalid login URI") 1.14 +) 1.15 + 1.16 +// Config holds the configuration values necessary to run a server. A Config 1.17 +// instance is the only way to instantiate a Context variable. 1.18 +type Config struct { 1.19 + ClientStore clientStore 1.20 + AuthCodeStore authorizationCodeStore 1.21 + ProfileStore profileStore 1.22 + TokenStore tokenStore 1.23 + SessionStore sessionStore 1.24 + Template *template.Template 1.25 + LoginURI string 1.26 + iterations int 1.27 +}