Coverage for nova/conf/consoleauth.py: 88%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-04-24 11:16 +0000

1# Copyright (c) 2016 Intel, Inc. 

2# Copyright (c) 2013 OpenStack Foundation 

3# All Rights Reserved. 

4# 

5# Licensed under the Apache License, Version 2.0 (the "License"); you may 

6# not use this file except in compliance with the License. You may obtain 

7# a copy of the License at 

8# 

9# http://www.apache.org/licenses/LICENSE-2.0 

10# 

11# Unless required by applicable law or agreed to in writing, software 

12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 

13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 

14# License for the specific language governing permissions and limitations 

15# under the License. 

16 

17from oslo_config import cfg 

18 

19consoleauth_group = cfg.OptGroup( 

20 name='consoleauth', 

21 title='Console auth options') 

22 

23consoleauth_opts = [ 

24 cfg.IntOpt('token_ttl', 

25 default=600, 

26 min=0, 

27 deprecated_name='console_token_ttl', 

28 deprecated_group='DEFAULT', 

29 help=""" 

30The lifetime of a console auth token (in seconds). 

31 

32A console auth token is used in authorizing console access for a user. 

33Once the auth token time to live count has elapsed, the token is 

34considered expired. Expired tokens are then deleted. 

35"""), 

36 cfg.BoolOpt( 

37 'enforce_session_timeout', 

38 default=False, 

39 help=""" 

40Enable or disable enforce session timeout for VM console. 

41 

42This allows operators to enforce a console session timeout. 

43When set to True, Nova will automatically close the console session 

44at the server end once token_ttl expires, providing enhanced 

45control over console session duration. 

46"""), 

47] 

48 

49 

50def register_opts(conf): 

51 conf.register_group(consoleauth_group) 

52 conf.register_opts(consoleauth_opts, group=consoleauth_group) 

53 

54 

55def list_opts(): 

56 return {consoleauth_group: consoleauth_opts}