Esempio n. 1
0
async def login(
    request: typing.Any,
    username: str,
    password: str,
    api: cannula.API,
) -> bool:
    resp = await api.call(
        LOGIN_MUTATION,
        variables={
            'username': username,
            'password': password,
        },
        request=request
    )

    if resp.errors:
        LOG.error(f'{resp.errors}')
        raise Exception('Unable to login user')

    LOG.info(f'Auth Response: {resp.data}')
    token = resp.data['login']
    user = set_user(
        username=token['user']['name'],
        auth_token=token['authToken'],
        catalog=token['catalog'],
        roles=token['roles']
    )

    response = RedirectResponse('/dashboard')
    response.set_cookie(SESSION_COOKE_NAME, user.session_id)
    return response
Esempio n. 2
0
def add_patient(patient: Patient, is_logged: bool = Depends(is_logged)):
    app.storage[app.counter] = patient
    response = RedirectResponse(url=f"/patient/{app.counter}")
    app.counter += 1
    return response
Esempio n. 3
0
async def login(request: Request, form: OAuth2PasswordRequestForm = Depends()):
    return RedirectResponse(url=request.url_for("auth.token"), status_code=307)
Esempio n. 4
0
def redirect_to_homepage(request):
    return RedirectResponse("/")
Esempio n. 5
0
def logout(session_token: str = Cookie(None)):
    check_token(session_token)
    app.tokens_list = [i for i in app.tokens_list if i != session_token]
    return RedirectResponse(url="/")
def main():
    return RedirectResponse(url="/docs/")
Esempio n. 7
0
async def logout(request: Request):
    request.session.pop('user', None)
    return RedirectResponse(url='/')
Esempio n. 8
0
async def get_api_docs():
    response = RedirectResponse(url='/redb/redoc')
    return response
 def logout(self, request: Request, callback_url: str) -> RedirectResponse:
     SessionManager(request=request).clear()
     logout_url = f"{self.client_config.authority}/oauth2/v2.0/logout?post_logout_redirect_uri={callback_url}"
     return RedirectResponse(url=logout_url)
Esempio n. 10
0
async def index():
    """
    Redirects to the docs.
    """
    return RedirectResponse(url="/redoc")
Esempio n. 11
0
def redirect_to_docs():
    redirect_url = "/api/v2/docs"  # replace with docs URL or use app.url_path_for()
    return RedirectResponse(url=redirect_url)
Esempio n. 12
0
async def redirect_to_docs():
    return RedirectResponse(url=DOCS_URL)
Esempio n. 13
0
async def redirect(request):
    return RedirectResponse(await get_url(request))
Esempio n. 14
0
async def auth(request):
    async with spotify.Client(CLIENT_ID, CLIENT_SECRET) as client:
        url = client.oauth2_url(
            redirect_uri=get_redirect_uri(request),
            scopes=['user-library-read', 'playlist-modify-public'])
        return RedirectResponse(url)
async def route_logout_and_remove_cookie():
    response = RedirectResponse(url="/")
    response.delete_cookie(API_KEY_NAME, domain=COOKIE_DOMAIN)
    return response
Esempio n. 16
0
def index(request: Request, return_to: str = ""):
    if return_to:
        logger.warning(f"Redirecting to: {return_to}")
        return RedirectResponse(url=return_to)
    return {'status': 'OK'}
Esempio n. 17
0
async def redirect_handler(request: Request, exc: HttpRedirect):
    return RedirectResponse(exc.location, status_code=exc.status)
Esempio n. 18
0
def docs_redirect():
    return RedirectResponse(f"{openapi_prefix}/docs")
Esempio n. 19
0
def root():
    return RedirectResponse("static/index.html")
Esempio n. 20
0
def authorization_redirect():
    """Redirect authorization requests to the Webex Teams OAuth flow."""
    logger.info("Redirecting to Webex Teams OAuth flow")
    user_key = uuid.uuid4()
    return RedirectResponse(
        f"{WEBEX_TEAMS_OAUTH_AUTHORIZATION_URL}&state={user_key}")
Esempio n. 21
0
 async def http_not_found_handler(request: Request, exc: Exception):
     return RedirectResponse(request.url_for('databases'))
Esempio n. 22
0
def login(response: Response, session_token=Depends(get_current_username)):
    response = RedirectResponse(url="/welcome")
    response.set_cookie(key="session_token", value=session_token)
    return response
Esempio n. 23
0
async def authorize(request: Request):
    token = await oauth2_client.orcid.authorize_access_token(request)
    request.session["token"] = token
    return RedirectResponse(url="/")
Esempio n. 24
0
def redirect(url: str) -> RedirectResponse:
    return RedirectResponse(url, status_code=HTTP_303_SEE_OTHER)
Esempio n. 25
0
async def logout(request: Request):
    request.session.pop("token", None)
    return RedirectResponse(url="/")
Esempio n. 26
0
def index():
    return RedirectResponse(url="index.html")
Esempio n. 27
0
def root():
  return RedirectResponse('/docs', 301)
Esempio n. 28
0
async def logout(is_logged: bool = Depends(is_logged)):
    response = RedirectResponse(url="/")
    response.delete_cookie("session")
    return response
Esempio n. 29
0
 def root() -> Any:
     return RedirectResponse("./docs")
Esempio n. 30
0
async def route_root(request: Request):
    return RedirectResponse("/pay")
Esempio n. 31
0
async def get_video(request):
    redirect_url = get_video_node(request)
    if redirect_url:
        return RedirectResponse(redirect_url)
    else:
        return HTMLResponse('404 Not found.', 404)