Ánh xạ vai trò máy khách của keycloak trên người dùng LDAP


0

Ánh xạ vai trò máy khách của keycloak trên người dùng LDAP, như gán vai trò quản lý lĩnh vực. Chúng tôi có thể chỉ định vai trò khách hàng quản lý lĩnh vực cho người dùng được nhập từ LDAP trong Keycloak không. Những thay đổi cần thiết trong tệp realm.json để cho phép người dùng LDAP có thể truy cập bảng điều khiển quản trị. (Quản lý người dùng và xem cảnh giới)

Chúng tôi đang cố gắng thiết lập liên kết người dùng dựa trên LDAP bằng cách nhập realm.json, được định cấu hình với cấu hình liên quan đến LDAP, nhưng không biết cấu hình cần được thực hiện trong realm.json để gán vai trò máy khách quản lý vùng như người dùng xem , xem khách hàng và quản lý lĩnh vực

//snippet of realm.json:
{
      "realm": "insight-engine",
      "enabled": true,
      "sslRequired": "external",
      "registrationAllowed": false,
      ...... some more configuration
      "requiredCredentials": [ "password" ],
      "roles" : {
        "realm" : [
        {
          "name": "user",
          "description": "User privileges"
        },
        {
          "name": "admin",
          "description": "Administrator privileges"
        }
        ]
      },
      "scopeMappings": [
      {
        "client": "js-console",
        "roles": ["user"]
      },
      {
        "client": "angular1",
        "roles": ["user"]
      }
      ],
      "clients": [
      {
        "clientId": "js-console",
        "enabled": true,
        "publicClient": true,
        "baseUrl": "/js-console",
        "redirectUris": [
          "/js-console/*"
        ],
        "webOrigins": []
      },
      {
        "clientId": "angular1",
        "enabled": true,
        "publicClient": true,
        "baseUrl": "/",
        "redirectUris": [
          "*"
        ],
        "webOrigins": []
      }
      ],
      "userFederationProviders": [
        {
          "displayName": "ldap",
          "providerName": "ldap",
          "priority": 1,
          "fullSyncPeriod": -1,
          "changedSyncPeriod": -1,
          "config": {
            "pagination" : "true",
            "debug" : "false",
            "searchScope" : "1",
            "connectionPooling" : "true",
            "usersDn" : "ou=People,dc=insight,dc=engine",
            "userObjectClasses" : "inetOrgPerson, organizationalPerson",
            "usernameLDAPAttribute" : "uid",
            "bindDn" : "cn=Administrator,dc=insight,dc=engine",
            "bindCredential" : "Cisco#321",
            "rdnLDAPAttribute" : "uid",
            "vendor" : "other",
            "editMode" : "WRITABLE",
            "uuidLDAPAttribute" : "entryUUID",
            "connectionUrl" : "ldap://ldap-external-service:389",
            "syncRegistrations" : "true",
            "authType" : "simple"
          }
        }
      ],
      "userFederationMappers" : [
        {
          "name" : "username",
          "federationMapperType" : "user-attribute-ldap-mapper",
          "federationProviderDisplayName" : "ldap-apacheds",
          "config" : {
            "ldap.attribute" : "uid",
            "user.model.attribute" : "username",
            "is.mandatory.in.ldap" : "true",
            "read.only" : "false",
            "always.read.value.from.ldap" : "false"
          }
        },
        {
          "name" : "first name",
          "federationMapperType" : "user-attribute-ldap-mapper",
          "federationProviderDisplayName" : "ldap-apacheds",
          "config" : {
            "ldap.attribute" : "cn",
            "user.model.attribute" : "firstName",
            "is.mandatory.in.ldap" : "true",
            "read.only" : "false",
            "always.read.value.from.ldap" : "false"
          }
        },
        {
          "name" : "creation date",
          "federationMapperType" : "user-attribute-ldap-mapper",
          "federationProviderDisplayName" : "ldap-apacheds",
          "config" : {
            "ldap.attribute" : "createTimestamp",
            "user.model.attribute" : "createTimestamp",
            "is.mandatory.in.ldap" : "false",
            "read.only" : "true",
            "always.read.value.from.ldap" : "false"
          }
        },
        {
          "name" : "modify date",
          "federationMapperType" : "user-attribute-ldap-mapper",
          "federationProviderDisplayName" : "ldap-apacheds",
          "config" : {
            "ldap.attribute" : "modifyTimestamp",
            "user.model.attribute" : "modifyTimestamp",
            "is.mandatory.in.ldap" : "false",
            "read.only" : "true",
            "always.read.value.from.ldap" : "false"
          }
        },
        {
          "name" : "realm roles",
          "federationMapperType" : "role-ldap-mapper",
          "federationProviderDisplayName" : "ldap-apacheds",
          "config" : {
            "roles.dn" : "ou=RealmRoles,dc=keycloak,dc=org",
            "membership.ldap.attribute" : "member",
            "role.name.ldap.attribute" : "cn",
            "role.object.classes" : "groupOfNames",
            "mode" : "LDAP_ONLY",
            "use.realm.roles.mapping" : "true"
          }
        },
        {
          "name" : "finance roles",
          "federationMapperType" : "role-ldap-mapper",
          "federationProviderDisplayName" : "ldap-apacheds",
          "config" : {
            "roles.dn" : "ou=FinanceRoles,dc=keycloak,dc=org",
            "membership.ldap.attribute" : "member",
            "role.name.ldap.attribute" : "cn",
            "role.object.classes" : "groupOfNames",
            "mode" : "LDAP_ONLY",
            "use.realm.roles.mapping" : "false",
            "client.id" : "finance"
          }
        }
      ],
      "clientScopeMappings": {
        "account": [
        {
          "client": "angular",
          "roles": ["view-profile"]
        }
        ],
        "realm-management": [
        {
          "client": "angular",
          "roles": ["manage-realm", "manage-users", "manage-clients"]
        }
        ]
      }
    }

Về cơ bản yêu cầu là khi chúng ta đăng nhập vào máy khách bằng thông tin xác thực LDAP, người dùng sẽ có thể truy cập ứng dụng quản lý người dùng và máy khách xem cảnh giới (tức là truy cập bảng điều khiển quản trị viên) từ phía máy khách.

Khi sử dụng trang web của chúng tôi, bạn xác nhận rằng bạn đã đọc và hiểu Chính sách cookieChính sách bảo mật của chúng tôi.
Licensed under cc by-sa 3.0 with attribution required.