mirror of https://github.com/jumpserver/jumpserver
feat: support rbac SSO token
parent
4bf337b2b4
commit
9a446c118b
|
@ -14,7 +14,6 @@ from rest_framework.response import Response
|
||||||
from authentication.errors import ACLError
|
from authentication.errors import ACLError
|
||||||
from common.api import JMSGenericViewSet
|
from common.api import JMSGenericViewSet
|
||||||
from common.const.http import POST, GET
|
from common.const.http import POST, GET
|
||||||
from common.permissions import OnlySuperUser
|
|
||||||
from common.serializers import EmptySerializer
|
from common.serializers import EmptySerializer
|
||||||
from common.utils import reverse, safe_next_url
|
from common.utils import reverse, safe_next_url
|
||||||
from common.utils.timezone import utc_now
|
from common.utils.timezone import utc_now
|
||||||
|
@ -38,8 +37,11 @@ class SSOViewSet(AuthMixin, JMSGenericViewSet):
|
||||||
'login_url': SSOTokenSerializer,
|
'login_url': SSOTokenSerializer,
|
||||||
'login': EmptySerializer
|
'login': EmptySerializer
|
||||||
}
|
}
|
||||||
|
rbac_perms = {
|
||||||
|
'login_url': 'authentication.add_ssotoken',
|
||||||
|
}
|
||||||
|
|
||||||
@action(methods=[POST], detail=False, permission_classes=[OnlySuperUser], url_path='login-url')
|
@action(methods=[POST], detail=False, url_path='login-url')
|
||||||
def login_url(self, request, *args, **kwargs):
|
def login_url(self, request, *args, **kwargs):
|
||||||
if not settings.AUTH_SSO:
|
if not settings.AUTH_SSO:
|
||||||
raise SSOAuthClosed()
|
raise SSOAuthClosed()
|
||||||
|
|
|
@ -24,7 +24,6 @@ exclude_permissions = (
|
||||||
('authentication', 'privatetoken', '*', '*'),
|
('authentication', 'privatetoken', '*', '*'),
|
||||||
('authentication', 'connectiontoken', 'delete,change', 'connectiontoken'),
|
('authentication', 'connectiontoken', 'delete,change', 'connectiontoken'),
|
||||||
('authentication', 'connectiontoken', 'view', 'connectiontokensecret'),
|
('authentication', 'connectiontoken', 'view', 'connectiontokensecret'),
|
||||||
('authentication', 'ssotoken', '*', '*'),
|
|
||||||
('authentication', 'superconnectiontoken', 'change,delete', 'superconnectiontoken'),
|
('authentication', 'superconnectiontoken', 'change,delete', 'superconnectiontoken'),
|
||||||
('authentication', 'temptoken', 'delete', 'temptoken'),
|
('authentication', 'temptoken', 'delete', 'temptoken'),
|
||||||
('users', 'userpasswordhistory', '*', '*'),
|
('users', 'userpasswordhistory', '*', '*'),
|
||||||
|
@ -156,6 +155,7 @@ only_system_permissions = (
|
||||||
('authentication', 'superconnectiontoken', '*', '*'),
|
('authentication', 'superconnectiontoken', '*', '*'),
|
||||||
('authentication', 'temptoken', '*', '*'),
|
('authentication', 'temptoken', '*', '*'),
|
||||||
('authentication', 'passkey', '*', '*'),
|
('authentication', 'passkey', '*', '*'),
|
||||||
|
('authentication', 'ssotoken', '*', '*'),
|
||||||
('tickets', '*', '*', '*'),
|
('tickets', '*', '*', '*'),
|
||||||
('orgs', 'organization', 'view', 'rootorg'),
|
('orgs', 'organization', 'view', 'rootorg'),
|
||||||
('terminal', 'applet', '*', '*'),
|
('terminal', 'applet', '*', '*'),
|
||||||
|
|
Loading…
Reference in New Issue