Creating token_expiration parameter

Sets keystone token lifetime (default 86400 seconds).

Change-Id: I9f8df93049865a9d67941e5e7d45b89d2aa5131b
This commit is contained in:
Doug Schaapveld 2013-12-10 10:12:43 -06:00
parent 8c8360ada5
commit 2439d2e5dc
2 changed files with 27 additions and 0 deletions

View File

@ -27,6 +27,8 @@
# Supports PKI and UUID.
# [token_driver] Driver to use for managing tokens.
# Optional. Defaults to 'keystone.token.backends.sql.Token'
# [token_expiration] Amount of time a token should remain valid (seconds).
# Optional. Defaults to 86400 (24 hours).
# [token_format] Deprecated: Use token_provider instead.
# [cache_dir] Directory created when token_provider is pki. Optional.
# Defaults to /var/cache/keystone.
@ -69,6 +71,7 @@ class keystone(
$token_format = false,
$token_provider = 'keystone.token.providers.pki.Provider',
$token_driver = 'keystone.token.backends.sql.Token',
$token_expiration = 86400,
$cache_dir = '/var/cache/keystone',
$memcache_servers = false,
$enabled = true,
@ -134,6 +137,9 @@ class keystone(
keystone_config {
'token/driver': value => $token_driver;
}
keystone_config {
'token/expiration': value => $token_expiration;
}
if($sql_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) {
require 'mysql::python'

View File

@ -196,6 +196,27 @@ describe 'keystone' do
end
describe 'when configuring token expiration' do
let :params do
{
'admin_token' => 'service_token',
'token_expiration' => '42',
}
end
it { should contain_keystone_config("token/expiration").with_value('42') }
end
describe 'when not configuring token expiration' do
let :params do
{
'admin_token' => 'service_token',
}
end
it { should contain_keystone_config("token/expiration").with_value('86400') }
end
describe 'configure memcache servers if set' do
let :params do
{