mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Initial move of the code of CuraPluginOAuth2Module
CURA-5744
This commit is contained in:
parent
dbe0d6d82a
commit
3830fa0fd9
7 changed files with 537 additions and 0 deletions
25
cura/OAuth2/AuthorizationRequestServer.py
Normal file
25
cura/OAuth2/AuthorizationRequestServer.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Copyright (c) 2018 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
from http.server import HTTPServer
|
||||
|
||||
from .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
|
||||
Loading…
Add table
Add a link
Reference in a new issue