<# .Description To get the required settings, please go to your BWSPortal OnPrem and BioID BWSPortal and click on the user settings in the top right corner. Copy API keys for onpremapikey and for apikey. The onpremsubject/subject is the email of the logged in user.. The value for onpremclientId can be found in the BioID BWSPortal. Select your client and go to update on-Prem client. The first entry - Client Id - is the value for onpremclientId. #> # Set here your apikey for your BWSPortal On-Premises $onpremapikey='' $onpremsubject='' $onpremhost='' $days='8' # Set here your apikey for BioID BWSPortal $apikey='' $subject='' $bioidhost='bwsportal.bioid.com' $onpremclientId='' # Get Bearer token for On-Premises Write-Output "Create On-Premises jwt - JSON Web Token..." $onpremtoken = .\jwt --sub "$onpremsubject" --key "$onpremapikey" Write-Output "Your on-prem jwt: $onpremtoken" # Get signed usage report from On-Premises Write-Output "Get signed usage report..." $usagereport = Invoke-WebRequest -Headers @{"Accept"="application/json"; "Authorization"="Bearer $onpremtoken"} -URI https://$onpremhost/api/usagereport/$days Write-Output "Signed usage report: $usagereport" # Get Bearer token for BWS Portal Write-Output "Create Portal jwt - JSON Web Token..." $token = .\jwt --sub "$subject" --key "$apikey" Write-Output "Your Portal jwt: $token" # Put signed usage report to BWSPortal Write-Output "Put signed usage report to Portal..." Invoke-WebRequest -Method PUT -Headers @{"Accept"="application/json"; "Authorization"="Bearer $token"; "Content-Type"="text/json"} -Body "$usagereport" -URI https://$bioidhost/api/usagereport # Get latest protection key from BWSPortal Write-Output "Get latest protection key..." $protectionkey = Invoke-WebRequest -Headers @{"Accept"="text/plain"; "Authorization"="Bearer $token"} -URI https://$bioidhost/api/protectionkey/$onpremclientId Write-Output "Latest protection key: $protectionkey" # Put latest protection key to On-Premises version Write-Output "Put latest protection key to On-Premises version..." $license = Invoke-WebRequest -Method PUT -Headers @{"Accept"="application/json"; "Authorization"="Bearer $onpremtoken"; "Content-Type"="application/json"} -Body "$protectionkey" -URI https://$onpremhost/api/protectionkey Write-Output LicenseInfo: $license