Azure / Azure/azure-libraries-for-java
[FEATURE REQ] Expose immutableID property during User creation/reading
- Dominant language
- Java
- Stars
- 97
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
In order to use Azure/AzureAD with a federated, external IDP (https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-saml-protocol-reference) it is important to define a users immutable ID during creation so the external IDP can use it. This parameter is already present in the `UserCreateParametersInner` class but not exposed to be set in the fluent API.
**Describe the solution you'd like**
The fluent API should expose this parameter so it can be set during user creation (and also when retrieving the users information again from Azure.
**Describe alternatives you've considered**
At the moment our workaround is to set this private property via reflection magic which works (example is in Kotlin):
```kotlin
fun WithCreate.withThisImmutableId(immutableId: String): WithCreate {
val user = this as ActiveDirectoryUser
val paramField = user.javaClass.getDeclaredField("createParameters")
paramField.isAccessible = true
val innerParams = paramField.get(user) as UserCreateParametersInner
innerParams.withImmutableId(immutableId)
return this
}
```
extraction can be performed similar also via reflection:
```kotlin
val getInnerAsyncMethod = adUser.javaClass.getDeclaredMethod("getInnerAsync")
getInnerAsyncMethod.isAccessible = true
@Suppress("UNCHECKED_CAST")
val obInner = getInnerAsyncMethod.invoke(adUser) as Observable
val innerUser = obInner.toBlocking().first()
return innerUser.immutableId()
```
Do you accept PRs regarding this issue? We could supply an extension PR to the fluent API if you like.
Contributor guide
Assessment
This issue has not been assessed yet.