Skip to content
Snippets Groups Projects
Commit 77f16e10 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

Fix indentation

parent fa40a03c
No related branches found
No related tags found
No related merge requests found
...@@ -8,34 +8,35 @@ from oidc_provider.models import Client, ResponseType ...@@ -8,34 +8,35 @@ from oidc_provider.models import Client, ResponseType
class Command(BaseCommand): class Command(BaseCommand):
help = 'Sets up an OIDC client / relaying party. For details check out the' + \ help = 'Sets up an OIDC client / relaying party. For details check out the' + \
'section on Relying Parties at https://django-oidc-provider.readthedocs.io' 'section on Relying Parties at https://django-oidc-provider.readthedocs.io'
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument('name', type=str, parser.add_argument('name', type=str,
help='A label that you associate with this client') help='A label that you associate with this client')
parser.add_argument('client_type', type=str, choices=['public', 'confidential'], parser.add_argument('client_type', type=str, choices=['public', 'confidential'],
help='The type of client can be either public or confidential') help='The type of client can be either public or confidential')
parser.add_argument('--client-id', type=int, dest='client_id', action='store', help='The client ID ') parser.add_argument('--client-id', type=int, dest='client_id', action='store', help='The client ID ')
parser.set_defaults(client_id=None) parser.set_defaults(client_id=None)
parser.add_argument('--client-secret', type=str, dest='client_secret', action='store', help='The client secret') parser.add_argument('--client-secret', type=str, dest='client_secret', action='store', help='The client secret')
parser.set_defaults(client_secret=None) parser.set_defaults(client_secret=None)
parser.add_argument('--no-require-consent', dest='require_consent', action='store_false', parser.add_argument('--no-require-consent', dest='require_consent', action='store_false',
help='By default user consent is required. Use this to skip user consent.') help='By default user consent is required. Use this to skip user consent.')
parser.add_argument('--no-reuse-consent', dest='reuse_consent', action='store_false', parser.add_argument('--no-reuse-consent', dest='reuse_consent', action='store_false',
help='By default user consent will be reused. Use this if the user should provide consent on every login.') help='By default user consent will be reused. Use this if the user should provide consent on every login.')
parser.set_defaults(require_consent=True, reuse_consent=True) parser.set_defaults(require_consent=True, reuse_consent=True)
parser.add_argument('-u', '--redirect-uri', type=str, action='append', parser.add_argument('-u', '--redirect-uri', type=str, action='append',
help='Redirect URI after successful authentication. Can be used more than once.') help='Redirect URI after successful authentication. Can be used more than once.')
parser.add_argument('-p', '--post-logout-redirect', type=str, action='append', parser.add_argument('-p', '--post-logout-redirect', type=str, action='append',
help='Post logout redirect URI. Can be used more than once.') help='Post logout redirect URI. Can be used more than once.')
parser.add_argument('-s', '--scope', type=str, action='append', parser.add_argument('-s', '--scope', type=str, action='append',
help='Authorized scope values for this client. Can be used more than once.') help='Authorized scope values for this client. Can be used more than once.')
parser.add_argument('-r', dest='response_types', action='append', parser.add_argument('-r', dest='response_types', action='append',
choices=['code', 'id_token', 'id_token token', 'code token', 'code id_token', 'code id_token token'], choices=['code', 'id_token', 'id_token token', 'code token', 'code id_token',
help='The type of response the client will get.') 'code id_token token'],
help='The type of response the client will get.')
parser.add_argument('-i', '--id-only', dest='id_only', action='store_true', parser.add_argument('-i', '--id-only', dest='id_only', action='store_true',
help='Do not print anything else then the ID of the newly created client '+\ help='Do not print anything else then the ID of the newly created client ' + \
'(and the client secret in case of confidential clients).') '(and the client secret in case of confidential clients).')
parser.set_defaults(id_only=False) parser.set_defaults(id_only=False)
def handle(self, *args, **options): def handle(self, *args, **options):
...@@ -50,8 +51,8 @@ class Command(BaseCommand): ...@@ -50,8 +51,8 @@ class Command(BaseCommand):
client_id = random.randint(100000, 999999) client_id = random.randint(100000, 999999)
counter += 1 counter += 1
if counter > 10000: if counter > 10000:
raise CommandError('Could not find a free client_id. Already'+ \ raise CommandError('Could not find a free client_id. Already' +
' tried 10000 times. There seems to be something seriously'+ \ ' tried 10000 times. There seems to be something seriously' +
' wrong with your setup. Please inspect manually.') ' wrong with your setup. Please inspect manually.')
try: try:
Client.objects.get(client_id=client_id) Client.objects.get(client_id=client_id)
...@@ -87,8 +88,8 @@ class Command(BaseCommand): ...@@ -87,8 +88,8 @@ class Command(BaseCommand):
) )
c.save() c.save()
except: except:
raise CommandError('Could not create an OpenID connect client' +\ raise CommandError('Could not create an OpenID connect client' +
f' due to the following error: {sys.exc_info()}') f' due to the following error: {sys.exc_info()}')
if options['response_types']: if options['response_types']:
try: try:
...@@ -96,8 +97,8 @@ class Command(BaseCommand): ...@@ -96,8 +97,8 @@ class Command(BaseCommand):
r = ResponseType.objects.get(value=r_value) r = ResponseType.objects.get(value=r_value)
c.response_types.add(r) c.response_types.add(r)
except: except:
raise CommandError('Client was stored, but could not set response_types'+\ raise CommandError('Client was stored, but could not set response_types' +
f' due to the following error: {sys.exc_info()}') f' due to the following error: {sys.exc_info()}')
if show_results: if show_results:
if options["id_only"]: if options["id_only"]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment