-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed ZMSUtils to correctly determine PrincipalType #2556
Conversation
Signed-off-by: Shimaoka Shuya <sshimaok@lycorp.co.jp>
Signed-off-by: Shimaoka Shuya <sshimaok@lycorp.co.jp>
Signed-off-by: Shimaoka Shuya <sshimaok@lycorp.co.jp>
I'll fix failed test. |
I have a few questions regarding this test code. After adding some conditions to determine the principal type,these lines started to fail. I had thought that additional note: athenz/servers/zms/src/test/java/com/yahoo/athenz/zms/ZMSTestInitializer.java Lines 122 to 167 in f4e68c5
|
If you’re using user as the prefix for your personal domains then yes, user.jack.sub1.api is a valid service principal. |
We don’t recommend using the same prefix for users and home domains - for backwards compatibility they’re the same value but from experience it’s confusing so we have switched to using user to identify users and home to identify personal domains. So when we get user.joe it’s always a user identity and when we get home.joe then it’s user’s personal domain. |
add the following two blocks on line 84 in the test case and that should fix the failure.
|
servers/zms/src/main/java/com/yahoo/athenz/zms/utils/ZMSUtils.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Shimaoka Shuya <sshimaok@lycorp.co.jp>
Thank you. I realized that someone had just not created the service because the tests were being conducted with the user and home domains being the same. |
Description
Background is similar to #2532.
When home domain and user domain are identical, the
ZMSUtils.principalType()
returnsPrincipal.Type.USER
regardless a provided principal string wasPrincipal.Type.GROUP
.e.g.
home domain = user domain =
personal
ZMSUtils.principalType("personal.hiragi-gkuth") // returns
USER
ZMSUtils.principalType("personal.hiragi-gkuth.service") // returns
USER
butSERVICE
is expectedZMSUtils.principalType("personal.hiragi-gkuth:group.mygroup") // returns
USER
butGROUP
is expectedZMSUtils.principalType("personal.hiragi-gkuth.subdomain:group.subgroup") // returns
USER
butGROUP
is expectedSo we add more conditions.
Contribution Checklist:
Attach Screenshots (Optional)