mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-25 14:50:24 +00:00
feat: support rbac SSO token
This commit is contained in:
@@ -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,7 @@ 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', 'ssotoken', 'change,delete', 'ssotoken'),
|
||||||
('authentication', 'superconnectiontoken', 'change,delete', 'superconnectiontoken'),
|
('authentication', 'superconnectiontoken', 'change,delete', 'superconnectiontoken'),
|
||||||
('authentication', 'temptoken', 'delete', 'temptoken'),
|
('authentication', 'temptoken', 'delete', 'temptoken'),
|
||||||
('users', 'userpasswordhistory', '*', '*'),
|
('users', 'userpasswordhistory', '*', '*'),
|
||||||
@@ -148,6 +148,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', '*', '*'),
|
||||||
|
Reference in New Issue
Block a user