def wrapped_function(*args, **kwargs): if request.method == "OPTIONS": resp = app.make_default_options_response() else: resp = make_response(f(*args, **kwargs)) patron_web_domains = app.manager.patron_web_domains if patron_web_domains: options = get_cors_options( app, dict(origins=patron_web_domains, supports_credentials=True) ) set_cors_headers(resp, options) return resp
def redeem_token(): _assert_github_login_toggle_enabled() try: verify_jwt_in_request(locations='cookies') except (NoAuthorizationError, ExpiredSignatureError): response = make_response('', 401) else: cookie = request.cookies.get( current_app.config['JWT_ACCESS_COOKIE_NAME']) response = make_response(jsonify({'data': cookie})) cors_options = { 'origins': current_app.config['UI_HOST_NAME'], 'supports_credentials': True } set_cors_headers(response, get_cors_options(current_app, cors_options)) return response