There is a security vulnerability in SSH key-generation using GitKraken < v8.0.1. If you used this tool to create SSH keys, please update GitKraken and regenerate. If you need help with this, contact forum-support@opengroup.org

Commit 924a89e1 authored by Alok Joshi's avatar Alok Joshi
Browse files

change getObjectIdfromInputId and unit tests

parent 00b5fef1
Pipeline #9277 passed with stages
in 17 minutes and 9 seconds
......@@ -477,7 +477,11 @@ public class EntitlementsAzure
*/
public String getObjectIdForInputId(String inputId)
{
// return inputId as-is for non-AAD tokens
UserPrincipal userPrincipal = getUserPrincipal();
UserType type = getType(userPrincipal);
if(type == UserType.OTHER)
return inputId;
return graphService.getObjectIdForInputId(inputId);
}
......
......@@ -652,4 +652,19 @@ public class EntitlementsAzureTests {
assertEquals(oid, updatedUserInfoDoc.getId());
}
@Test
public void getOidFromGraphService_whenGivenAADUserPrincipal() {
createUserPrincipalSetSecurityContext(TestUtils.APPID, TestUtils.getAppId(), TestUtils.OID, TestUtils.getOid());
when(graphService.getObjectIdForInputId(TestUtils.getAppId())).thenReturn(TestUtils.getOid());
String oid = sut.getObjectIdForInputId(TestUtils.getAppId());
assertEquals(oid, TestUtils.getOid());
}
@Test
public void getOidFromInput_whenGivenOtherUserPrincipal() {
createUserPrincipalSetSecurityContext(TestUtils.USERID, TestUtils.getUserId(), TestUtils.EMAIL, TestUtils.getUserEmail());
String oid = sut.getObjectIdForInputId(TestUtils.getOid());
assertEquals(oid, TestUtils.getOid());
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment