YAPF formatting for actions/auth_pubtkt

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati 2018-02-02 18:07:44 +05:30 committed by James Valleroy
parent 5e20a47bf4
commit 1d1328fcd1
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -23,9 +23,9 @@ sign it with the FreedomBox server's private key.
import argparse import argparse
import base64 import base64
import datetime import datetime
from OpenSSL import crypto
import os import os
from OpenSSL import crypto
from plinth import action_utils from plinth import action_utils
KEYS_DIRECTORY = '/etc/apache2/auth-pubtkt-keys' KEYS_DIRECTORY = '/etc/apache2/auth-pubtkt-keys'
@ -36,20 +36,18 @@ def parse_arguments():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command') subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
subparsers.add_parser( subparsers.add_parser('create-key-pair',
'create-key-pair', help='create a key pair for the apache server '
help='create a key pair for the apache server ' 'to sign auth_pubtkt tickets')
'to sign auth_pubtkt tickets') subparsers.add_parser('enable-mod',
subparsers.add_parser( help='enabled the Apache module auth_pubtkt')
'enable-mod', help='enabled the Apache module auth_pubtkt') gen_tkt = subparsers.add_parser('generate-ticket',
gen_tkt = subparsers.add_parser( help='generate auth_pubtkt ticket')
'generate-ticket', help='generate auth_pubtkt ticket')
gen_tkt.add_argument('--uid', help='username of the user') gen_tkt.add_argument('--uid', help='username of the user')
gen_tkt.add_argument( gen_tkt.add_argument('--private-key-file',
'--private-key-file', help='path of the private key file of the server')
help='path of the private key file of the server') gen_tkt.add_argument('--tokens',
gen_tkt.add_argument( help='tokens, usually containing the user groups')
'--tokens', help='tokens, usually containing the user groups')
subparsers.required = True subparsers.required = True
return parser.parse_args() return parser.parse_args()
@ -89,14 +87,8 @@ def subcommand_create_key_pair(_):
os.chmod(fil, 0o440) os.chmod(fil, 0o440)
def create_ticket(pkey, def create_ticket(pkey, uid, validuntil, ip=None, tokens=None, udata=None,
uid, graceperiod=None, extra_fields=None):
validuntil,
ip=None,
tokens=None,
udata=None,
graceperiod=None,
extra_fields=None):
"""Create and return a signed mod_auth_pubtkt ticket.""" """Create and return a signed mod_auth_pubtkt ticket."""
fields = [ fields = [
'uid={}'.format(uid), 'validuntil={}'.format(validuntil, type='d'), ip 'uid={}'.format(uid), 'validuntil={}'.format(validuntil, type='d'), ip