Example #1
0
        def hp_oneview_client_exception(exception):
            logging.exception(exception)
            response = ResponseBuilder.error_by_hp_oneview_exception(exception)

            # checking if session has expired on Oneview
            if config.auth_mode_is_session() and \
                    response.status_code == status.HTTP_401_UNAUTHORIZED:
                token = request.headers.get('x-auth-token')
                client_session.clear_session_by_token(token)

            return response
def delete_session(session_id):
    token = request.headers.get('x-auth-token')
    session_for_delete = client_session.get_session_id_by_token(token)

    if session_id != session_for_delete:
        abort(status.HTTP_404_NOT_FOUND)

    client_session.clear_session_by_token(token)

    return Response(status=status.HTTP_204_NO_CONTENT,
                    mimetype="application/json")