auth
auth/config.go
Add kubernetes definitions. Define a replication controller that will spin up authd servers (using Ducky right now--other instances should rename the ducky parts appropriately). Also, my understanding of which labels go where may be shaky, which is probably evidenced by the fact that all of these things share the same lables. _Whatever_. It also hooks the generated pods up to the JWT secret volume, so they can properly read the JWT secret. Also, created a LoadBalancer Service that will route traffic to the pods created by the Replication Controller.
1 package auth
3 import (
4 "errors"
5 "html/template"
6 "log"
7 )
9 var (
10 // ErrInvalidLoginURI is returned when a Context is instantiated with a Config object that specifies a LoginURI that can't be parsed as a URL.
11 ErrInvalidLoginURI = errors.New("invalid login URI")
12 // ErrConfigNotInitialized is returned when a Context is instantiated with a Config object that hasn't had its Init function called.
13 ErrConfigNotInitialized = errors.New("config not initialized")
15 // Version is used to keep track of what version of the build this is
16 Version string
17 )
19 // Config holds the configuration values necessary to run a server. A Config
20 // instance is the only way to instantiate a Context variable.
21 type Config struct {
22 ClientStore clientStore
23 AuthCodeStore authorizationCodeStore
24 ProfileStore profileStore
25 TokenStore tokenStore
26 SessionStore sessionStore
27 ScopeStore scopeStore
28 LoginVerificationNotifier loginVerificationNotifier
29 Template *template.Template
30 LoginURI string
31 JWTPrivateKey []byte
32 iterations int
33 secureCookie bool
34 }
36 // Init is a function that preps the Config object to be used for Context creation, setting variables
37 // that are determined at the beginning of program execution.
38 func (c *Config) Init() error {
39 scheme, ok := passphraseSchemes[CurPassphraseScheme]
40 if !ok {
41 return ErrInvalidPassphraseScheme
42 }
43 var err error
44 c.iterations, err = scheme.calculateIterations()
45 if err != nil {
46 return err
47 }
48 log.Printf("Generating passphrases with %d iterations...\n", c.iterations)
49 return nil
50 }