deploymenttheory / terraform-provider-jamfpro

Jamf Pro Terraform Provider/Plugin written with the TF Provider SDK v2. Written in go
Mozilla Public License 2.0
26 stars 10 forks source link

Feature Request: Add support for /api/v1/auth/token to obtain a Bearer Token #149

Closed ecanault closed 4 months ago

ecanault commented 4 months ago

Hi,

Of course using API roles and clients is the future and must replace legacy API accounts... but... it will really be helpful to be able to obtain also a bearer token with a traditional API account.

The reason : with a fresh new instance, it’s possible to initialize the console through API (activation code, 1st local account, ...) and then use this 1st local account as an authentication base to then build the firsts policies, scripts, groups, etc... this intial setup will be also the occasion to create API roles and clients to subsequently maintain the Jamf Pro console.

So is it possible to add in the provider options the Username and the Password variables? And then say “if username and password are defined, then use the traditional /api/v1/auth/token (that will still be valid after March 31st) to obtain a bearer token?

Thank you.

ShocOne commented 4 months ago

Hi there,

I've added classic auth support to the http client and downstream added the support into the terraform provider. You should now be able to either authenticate with a client_id / client_secret pair or a username / password pair. Be aware that if you present both sets of credential pairs that oauth based creds will always win. This is by design.

Username and the Password, will auth against /api/v1/auth/token as suggested.

You can find this in release v0.0.43.

Please test and report your feedback. thanks