Skip to content
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

Empty role map throws java.util.NoSuchElementException #367

Open
misterzero opened this issue Apr 14, 2021 · 0 comments
Open

Empty role map throws java.util.NoSuchElementException #367

misterzero opened this issue Apr 14, 2021 · 0 comments

Comments

@misterzero
Copy link

The following code threw this java.util.NoSuchElementException:

okta-aws awsdev sts get-caller-identity
Username: [email protected]
Password: 
Exception in thread "main" java.util.NoSuchElementException
	at java.base/java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:721)
	at java.base/java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:751)
	at java.base/java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:749)
	at com.okta.tools.helpers.RoleHelper.chooseAwsRoleToAssume(RoleHelper.java:106)
	at com.okta.tools.OktaAwsCliAssumeRole.doRequest(OktaAwsCliAssumeRole.java:133)
	at com.okta.tools.OktaAwsCliAssumeRole.run(OktaAwsCliAssumeRole.java:102)
	at com.okta.tools.WithOkta.main(WithOkta.java:30)

https://github.com/oktadeveloper/okta-aws-cli-assume-role/blob/7a47adbcd67004dfc27678efdf5d45e13b9df475/src/main/java/com/okta/tools/helpers/RoleHelper.java#L106

I need to figure out why I did not have any roles available, however it would save troubleshooting time to provide a more clear error message like:

} else if (roleIdpPairs.size() < 1) {
  throw new NoSuchElementException("No roles available for this user")
} else {
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant