forked from shaba/openuds
fixed authenticators rest
This commit is contained in:
parent
46b6bb2305
commit
301d68b1a2
@ -96,10 +96,10 @@ class Authenticators(ModelHandler):
|
|||||||
|
|
||||||
def getGui(self, type_: str) -> typing.List[typing.Any]:
|
def getGui(self, type_: str) -> typing.List[typing.Any]:
|
||||||
try:
|
try:
|
||||||
tgui = auths.factory().lookup(type_)
|
authType = auths.factory().lookup(type_)
|
||||||
if tgui:
|
if authType:
|
||||||
field = self.addDefaultFields(
|
field = self.addDefaultFields(
|
||||||
tgui.guiDescription(),
|
authType.guiDescription(),
|
||||||
['name', 'comments', 'tags', 'priority', 'small_name', 'networks'],
|
['name', 'comments', 'tags', 'priority', 'small_name', 'networks'],
|
||||||
)
|
)
|
||||||
self.addField(
|
self.addField(
|
||||||
@ -134,8 +134,8 @@ class Authenticators(ModelHandler):
|
|||||||
for v in MFA.objects.all()
|
for v in MFA.objects.all()
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
'label': ugettext('MFA Provider'),
|
'label': gettext('MFA Provider'),
|
||||||
'tooltip': ugettext(
|
'tooltip': gettext(
|
||||||
'MFA provider to use for this authenticator'
|
'MFA provider to use for this authenticator'
|
||||||
),
|
),
|
||||||
'type': gui.InputField.CHOICE_TYPE,
|
'type': gui.InputField.CHOICE_TYPE,
|
||||||
|
@ -38,12 +38,14 @@ import time
|
|||||||
import types
|
import types
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from django import http
|
from django.http import HttpResponse
|
||||||
|
|
||||||
# from xml_marshaller import xml_marshaller
|
# from xml_marshaller import xml_marshaller
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
if typing.TYPE_CHECKING:
|
||||||
|
from django.http import HttpRequest
|
||||||
|
|
||||||
class ParametersException(Exception):
|
class ParametersException(Exception):
|
||||||
pass
|
pass
|
||||||
@ -57,9 +59,9 @@ class ContentProcessor:
|
|||||||
mime_type: typing.ClassVar[str] = ''
|
mime_type: typing.ClassVar[str] = ''
|
||||||
extensions: typing.ClassVar[typing.Iterable[str]] = []
|
extensions: typing.ClassVar[typing.Iterable[str]] = []
|
||||||
|
|
||||||
_request: http.HttpRequest
|
_request: 'HttpRequest'
|
||||||
|
|
||||||
def __init__(self, request: http.HttpRequest):
|
def __init__(self, request: 'HttpRequest'):
|
||||||
self._request = request
|
self._request = request
|
||||||
|
|
||||||
def processGetParameters(self) -> typing.MutableMapping[str, typing.Any]:
|
def processGetParameters(self) -> typing.MutableMapping[str, typing.Any]:
|
||||||
@ -83,7 +85,7 @@ class ContentProcessor:
|
|||||||
Converts an obj to a response of specific type (json, XML, ...)
|
Converts an obj to a response of specific type (json, XML, ...)
|
||||||
This is done using "render" method of specific type
|
This is done using "render" method of specific type
|
||||||
"""
|
"""
|
||||||
return http.HttpResponse(
|
return HttpResponse(
|
||||||
content=self.render(obj), content_type=self.mime_type + "; charset=utf-8"
|
content=self.render(obj), content_type=self.mime_type + "; charset=utf-8"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user