Add cookie configuration

This commit is contained in:
allegroai 2019-07-09 00:00:44 +03:00
parent 5c8519be1e
commit b5cc858494
2 changed files with 22 additions and 1 deletions

View File

@ -41,6 +41,27 @@
# cookie containing auth token, for requests arriving from a web-browser # cookie containing auth token, for requests arriving from a web-browser
session_auth_cookie_name: "trains_token_basic" session_auth_cookie_name: "trains_token_basic"
# cookie configuration for authorization cookies generated by auth.login
cookies {
httponly: true # allow only http to access the cookies (no JS etc)
secure: false # not using HTTPS
domain: null # Limit to localhost is not supported
max_age: 99999999999
}
# # A list of fixed users
# fixed_users {
# enabled: true
# users: [
# {
# username: "john"
# password: "123456"
# name: "john doe"
# }
#
# ]
# }
} }
cors { cors {

View File

@ -63,7 +63,7 @@ def before_request():
if call.result.cookies: if call.result.cookies:
for key, value in call.result.cookies.items(): for key, value in call.result.cookies.items():
response.set_cookie(key, value, httponly=True) response.set_cookie(key, value, **config.get("apiserver.auth.cookies"))
return response return response
except Exception as ex: except Exception as ex: