-
Notifications
You must be signed in to change notification settings - Fork 143
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
NPE occurs if account has no localAccountId #669
Comments
Hello @GregDThomas : Sorry for the delayed response on this. Just to be clear, you're seeing this issue after making a silent call, right? (i.e., you get a token without a If so, the reason seems to be that when checking for cached accounts we check if a certain string contains the Could you describe your use case a bit more? As long as your getting ID tokens I'd assume they'd have either a I'll confirm this behavior is a bug (and not something we should be flagging) and get a fix in the next release (no ETA yet, but it should be soon) |
Hi - that's right. It's essentially a straight lift of the code from the sample referenced, but it;
|
Are you using ADFS, B2C, or some sort of guest account? Just trying to get an idea of what scenarios would lead to that |
Ah, sorry missed that. It's just "my account" on a local domain. This particular domain isn't really used for logging in - it's more for providing a directory of users for testing applications. |
The "ultimate" use case is for an REST API exposed by a Java application. Some of the clients will be "humans", but there will be some M2M clients which will use credentials of "service accounts" - i.e. not authorised directly with AD, but can access the credentials of an account in AD that it will use to gain a token. |
Aside; I've just tried with another AD account - that of the one I actually use to login to Windows. That too has no |
And yes, we're using an ADFS end-point to get the token |
In your console output you list ID token as *REDACTED , but you are getting an ID token, right? If so, could you decode the token (at a site like this one) and confirm whether or not there is a 'sub' and/or 'oid' section? If you have those, then you shouldn't be getting an NPE (the I can't recreate the issue using our test ADFS accounts, so my only other guess is that it's an issue with that sample rather than in the code. You said it was basically a straight lift, but did you make any changes to the code (particularly around the "getAccounts" or the PublicClientApplication creation logic)? |
Below is the full decoded token (albeit details redacted again in places) - as you suspect there is no {
"aud": "(uuid)",
"iss": "(url)",
"iat": 1688750275,
"nbf": 1688750275,
"exp": 1688753875,
"auth_time": 1688750275,
"sub": "(opaque string)",
"upn": "(principle name)",
"unique_name": "(domain)\\(username)",
"sid": "(uid)",
"email": "(email)",
"given_name": "Greg",
"family_name": "Thomas",
"group": [
"list",
"of",
"groups"
],
"winaccountname": "(account name)",
"apptype": "Public",
"appid": "(uuid)",
"authmethod": "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport",
"ver": "1.0",
"scp": "openid"
} With regards to the sample, the only change I made was to import a CA certificate in to the JVM at the very beginning - without which I get TLS errors. |
I doubt it is much help, but for completeness the header is; {
"typ": "JWT",
"alg": "RS256",
"x5t": "(opaque string)",
"kid": "(same opaque string)"
} |
This was fixed as part of #684, which is now in the latest 1.13.10 release. |
Than ks - I can confirm I'm no longer getting an NPE. |
Steps to reproduce
localAccountId
.Expected results
Actual results
localAccountId
and the following statement throws an NPE;if (accCached.homeAccountId().contains(accCached.localAccountId())) {
The text was updated successfully, but these errors were encountered: