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が設定されている場合、クライアントは使用するスコープを許可スコープのリストに設定する必要があります。

関連する問題