0

마이크로 서비스 환경을 작동 시키려고합니다. 이미 config-server, eureka-server, zuul-server 및 service를 설치했습니다. 보안을 위해 Cloud Foundry의 UAA 서버가 설치되어 실행 중입니다.스코프로 Ldap 그룹을 클라우드 파운드리 uaa authorization_code 부여 유형에 사용할 수 있습니까?

UAA 서버를 설정하는 방법에 관한 문서가 있으므로 Ldap Groups as Scopes 옵션이 있으며 UAA 서버 로그에서 어떻게 생성되는지 볼 수는 있지만 JWT 토큰에 들어 가지 않습니다. Zuul이 UAA 서버에 올바르게 프록 싱하고 있습니다. UAA에서 인증 프로세스를 수행하고 Zuul에서 JWT 토큰을 얻습니다. 그런 다음 zuul은 프록시 서비스를 그 뒤에있는 서비스에 추가하지만 로그인 된 사용자의 그룹/범위는 openid 범위 만 사용합니다. 클라이언트 구성에서. 내가 놓친 게 있니? 또는 이것이 작동하는 방식이며 토큰에서 사용자의 사용자 이름을 얻고 각 서비스에 대한 각 요청에 대한 액세스 권한을 얻는 해결 방법을 구현해야합니다.

spring_profiles: ldap,mysql 

disableInternalUserManagement: true 

zones: 
    internal: 
    hostnames: 
     - sso.example.com 

oauth: 
    user: 
    authorities: 
     - openid 
     - scim.me 
     - password.write 
     - scim.userids 
     - uaa.user 
     - approvals.me 
     - oauth.approvals 
    clients: 
    sso: 
     secret: changeme! 
     authorized-grant-types: authorization_code, refresh_token 
     # How do I add the user groups as scopes? 
     # Is it possible with this grant type? 
     scope: openid 
     authorities: uaa.resource 

ldap: 
    profile: 
    file: ldap/ldap-search-and-bind.xml 
    base: 
    url: ldap://ldap.example.com:389 
    mailAttributeName: mail 
    mailSubstitute: '{0}@example.com' 
    mailSubstituteOverridesLdap: true 
    userDn: 'CN=Example User,OU=Admins,DC=example,DC=com' 
    password: 'changeme!' 
    searchBase: 'dc=example,dc=com' 
    searchFilter: 'sAMAccountName={0}' 
    groups: 
    file: ldap/ldap-groups-as-scopes.xml 
    searchBase: 'dc=example,dc=com' 
    groupRoleAttribute: cn 
    searchSubtree: true 
    groupSearchFilter: 'member={0}' 
    maxSearchDepth: 1 
    autoAdd: true 
    attributeMappings: 
    first_name: 'givenName' 
    last_name: 'sn' 

smtp: 
    host: mail.example.com 
    port: 25 

database: 
    url: jdbc:mysql://mysql.example.com/uaa 
    username: uaa 
    password: changeme! 

jwt: 
    token: 
    verification-key: | 
     -----BEGIN PUBLIC KEY----- 
     -----END PUBLIC KEY----- 
    signing-key: | 
     -----BEGIN RSA PRIVATE KEY----- 
     -----END RSA PRIVATE KEY----- 

login: 
    url: https://sso.example.com/uaa/login 
    branding: 
    companyName: 'Example Company' 

답변

0

문제가 클라이언트에 구성되어하지 않는 범위에서 유래 :

여기 내 uaa.yml입니다. 해당 클라이언트의 범위 목록에있는 범위 만 사용자 JWT에있을 수 있습니다. 이 목록에 범위를 추가하면 사용자가 보유하지 않은 범위를 얻을 수 없으며 클라이언트의 클라이언트 자격 증명 토큰에 해당 범위가 나타나지 않습니다.

groups-as-scope를 구성한 경우 클라이언트는 허용 범위 목록에서 사용하려는 각 범위를 구성해야합니다.

관련 문제