Cura/cura/OAuth2/AuthorizationRequestServer.py
Jaime van Kessel 3ae223334f Removed relative imports
Since the oauth module isn't just in a plugin anymore, there is no need for any of the relative imports

CURA-5744
2018-09-21 12:02:11 +02:00

25 lines
1.2 KiB
Python

# Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from http.server import HTTPServer
from cura.OAuth2.AuthorizationHelpers import AuthorizationHelpers
class AuthorizationRequestServer(HTTPServer):
"""
The authorization request callback handler server.
This subclass is needed to be able to pass some data to the request handler.
This cannot be done on the request handler directly as the HTTPServer creates an instance of the handler after init.
"""
def setAuthorizationHelpers(self, authorization_helpers: "AuthorizationHelpers") -> None:
"""Set the authorization helpers instance on the request handler."""
self.RequestHandlerClass.authorization_helpers = authorization_helpers
def setAuthorizationCallback(self, authorization_callback) -> None:
"""Set the authorization callback on the request handler."""
self.RequestHandlerClass.authorization_callback = authorization_callback
def setVerificationCode(self, verification_code: str) -> None:
"""Set the verification code on the request handler."""
self.RequestHandlerClass.verification_code = verification_code