def authorize()

in source/openid-waitingroom/chalice/app.py [0:0]


def authorize():
    """
    This is the authorize endpoint
    """
    app.log.info('/authorize')
    app.log.info(app.current_request.to_dict())
    try:
        client_id, redirect_uri, response_type, state, scope, _ = extract_oidc_request(
        )
        # validate query parameters
        if validate_oidc_request(client_id, redirect_uri, response_type,
                                 scope):
            app.log.info('valid /authorize request')
            # redirect to the bucket login page with parameters
            return Response(status_code=302,
                            body=None,
                            headers={
                                'Location':
                                (f'{WWW_RESOURCES_URL}/login.html?' +
                                 f'client_id={client_id}&' +
                                 f'redirect_uri={redirect_uri}&' +
                                 f'response_type={response_type}&' +
                                 f'state={state}&' + f'scope={scope}'),
                                'Content-Type':
                                'text/html'
                            })
        app.log.info('invalid /authorize request')
    except (KeyError, IndexError, TypeError):
        app.log.error('validation failed')
    return Response(status_code=400,
                    body='Bad Request',
                    headers={'Content-Type': 'text/plain'})