onelogin / onelogin-aws-cli-assume-role

MIT License
29 stars 38 forks source link

Add support for reading API creds from command args #21

Closed jutley closed 4 years ago

jutley commented 5 years ago

Currently, it seems like we need to have the properties file and jar in the same directory (#20). This restricts how we can run the jar. I noticed that the Python version allows the client id, client secret, and region to be specified in the command arguments, so that's what I am replicating with this PR.

Unfortunately the naming is inconsistent between Python and Java. For example, in the python client region is the OneLogin region, but in the java client region is the AWS region. For this reason, I did not try to stick to Python names, and chose very OneLogin-specific names instead.

This PR also fixes a small bug in validating the AWS Account ID and AWS Role Name arguments. Originally we see tests like this:

((awsAccountId != null && awsAccountId.isEmpty()) && (awsRoleName == null || awsRoleName.isEmpty()))

The first half should be checking that the string is NOT empty.

Fixes #20 (mostly)