(config *conf.Configuration, tokenString string, session bool, w http.ResponseWriter)
| 214 | } |
| 215 | |
| 216 | func (a *API) setCookieToken(config *conf.Configuration, tokenString string, session bool, w http.ResponseWriter) error { |
| 217 | exp := time.Second * time.Duration(config.Cookie.Duration) |
| 218 | cookie := &http.Cookie{ |
| 219 | Name: config.Cookie.Key, |
| 220 | Value: tokenString, |
| 221 | Secure: true, |
| 222 | HttpOnly: true, |
| 223 | Path: "/", |
| 224 | } |
| 225 | if !session { |
| 226 | cookie.Expires = time.Now().Add(exp) |
| 227 | cookie.MaxAge = config.Cookie.Duration |
| 228 | } |
| 229 | |
| 230 | http.SetCookie(w, cookie) |
| 231 | return nil |
| 232 | } |
| 233 | |
| 234 | func (a *API) clearCookieToken(ctx context.Context, w http.ResponseWriter) { |
| 235 | config := getConfig(ctx) |
no outgoing calls
no test coverage detected