NewServer returns a new account app on top of the given store.
(c *component.Component, store account_store.TransactionalInterface, config oauth.Config, cspFunc func(config *oauth.Config, nonce string) string)
| 62 | |
| 63 | // NewServer returns a new account app on top of the given store. |
| 64 | func NewServer(c *component.Component, store account_store.TransactionalInterface, config oauth.Config, cspFunc func(config *oauth.Config, nonce string) string) (Server, error) { |
| 65 | s := &server{ |
| 66 | c: c, |
| 67 | config: config, |
| 68 | store: store, |
| 69 | session: sess.Session{ |
| 70 | Store: &sessionStore{store}, |
| 71 | CookieMaxAge: config.Login.SessionTTL, |
| 72 | }, |
| 73 | generateCSP: cspFunc, |
| 74 | schemaDecoder: schema.NewDecoder(), |
| 75 | } |
| 76 | s.schemaDecoder.IgnoreUnknownKeys(true) |
| 77 | |
| 78 | if s.config.Mount == "" { |
| 79 | s.config.Mount = s.config.UI.MountPath() |
| 80 | } |
| 81 | |
| 82 | return s, nil |
| 83 | } |
| 84 | |
| 85 | type ctxKeyType struct{} |
| 86 |