Jenkins API - Add credentials - jenkins

I am adding credentials to my jenkins server via the REST API. When I try to use them it does not work.
When I copy the token-hash from the credentials.xml file and decode it like here, I get the token I sent via the API but with additional spacing before the token and a linebreak afterwards. How can I remove that?
Saved via the GUI:
q4nL6VYHNy7PoyfKGj7z
Sent via the api:
q4nL6VYHNy7PoyfKGj7z
This is the XML I send to the server
<io.jenkins.plugins.gitlabserverconfig.credentials.PersonalAccessTokenImpl plugin="gitlab-branch-source#1.5.9">
<scope>GLOBAL</scope>
<id>name</id>
<description>description</description>
<token>secret-token</token>
</io.jenkins.plugins.gitlabserverconfig.credentials.PersonalAccessTokenImpl>

Related

Respond from Slack to my API endpoint not working

When I set the request URL in slack it shows verify but it will not send any data to my API. This API is used in my WordPress plugin. My API URL contains HTTP. Previously it worked.
All of my client don't have HTTPS some of them using HTTP so how can I solve the issue.

JMeter OAuth2.0 Auth0 access token

How to generate OAuth2.0 access tokens in Jmeter.?
I'm able to get the setup for Postman using OAuth2.0. However, when I want to test these and develop script in JMeter, I am unable to get through it.
This postman setup doesnt ask for client_secretKey only required client_Id, instead it pops up a window where I enter the username and password and then it is redirected/called back to my application URL.
When I looked into the URL, it has the following parameters
https://product.auth0.com/authorize?
redirect_uri=abc.com
client_id=XXX
errorPath=%2Ferror
scope=openid%20profile%20email%20offline_access
response_type=code
response_mode=query
state=dynamicvalue1
nonce=dynamicvalue2
code_challenge=dynamicvalue3
code_challenge_method=S256
auth0Client=staticvalue HTTP/1.1
I know client_secretKey, now I am wondering if I can able to get to the authorisation/authentication of the application by using the client ID, secretKey grant type etc?
Please suggest on ways I can connect to and access the application.
Postman is a browser plugin, JMeter is not a browser hence it cannot "pop up w window"
The easiest way of capturing the network requests from Posman in JMeter is just recording it using JMeter's HTTP(S) Test Script Recorder.
Start JMeter's HTTP(S) Test Script Recorder
Import JMeter's certificate into Postman
Configure Postman to use JMeter as the proxy
Run your request in Postman.
JMeter should generate proper HTTP Request sampler and HTTP Header Manager and you should be able to replay the request.
Identify the dynamic parameters and perform their correlation
You should be able to replay the authorization flow using JMeter now.

Access Control Entries - where can i get 'token'

API Link
Azure DevOps Rest API:
I try use my personal access token to request, but it doesn't look like success.
Postman request:
The token format is :
"token": "$PROJECT:vstfs:///Classification/TeamProject/projectid"
For example:
You could also get the token in Browser Network tab.
Here are the steps:
Press F12 in Browser to open Browser Developer tool.
Manually change the permission and check the network record.
You can find the token info in Request Payload.

DeleteMessage Action - Invalid Receipt Handle

Task is to receive messages and delete messages. Am modeling this in Postman. I can successfully execute the receive messages action, but not the delete message action.
I have tried copying the receipt handle string from the receive messages response and using it in the delete messages request, and also tried url encoding the string. Both returned errors
In Postman I run the aws sqs ReceiveMessage action and get the ReceiptHandle
<ReceiptHandle>AQEBjiliZegyBS/ZO9wta+a/heA/tSx/f6tLFqfH38jEZ2r9zguHAljXhG/B8tXaM+S6MKs/XGyZ206S3NC2V38CUKLO+sPF0mfP47wqu7+nAIwettlxTGQAYuCFqI1CYBYHXxgajB1UEiFz8Kc6v8SlWs/VPLX+IWjckoQOtMRl977sxM5pCLhMNvIwh1RYFvybM0D0WEbJEuYb9JU3DZuRZg/K5rjvNooPqER4FR1JJxpZiJ0tu6481CyePLtEh/J4+Yd2kYRyuqN788oEdSTZIKprA6lHUCiCmeuqCb0yEDsxJcCVX4GmDok5KMHm/E2bgjpRjVRxZ+mrnLqTSwojt0LXg61vv8dNF8QD4sngPXqhmKQ7yp5O6S8ygn4lIPaUGOl5cgX1HsB3Q9Pfv3sg4A==</ReceiptHandle>
Then I run the aws sqs DeleteMessage action
Try #1
Pass the ReceiptHandle with exact copy
Action=DeleteMessage&ReceiptHandle=AQEBjiliZegyBS/ZO9wta+a/heA/tSx/f6tLFqfH38jEZ2r9zguHAljXhG/B8tXaM+S6MKs/XGyZ206S3NC2V38CUKLO+sPF0mfP47wqu7+nAIwettlxTGQAYuCFqI1CYBYHXxgajB1UEiFz8Kc6v8SlWs/VPLX+IWjckoQOtMRl977sxM5pCLhMNvIwh1RYFvybM0D0WEbJEuYb9JU3DZuRZg/K5rjvNooPqER4FR1JJxpZiJ0tu6481CyePLtEh/J4+Yd2kYRyuqN788oEdSTZIKprA6lHUCiCmeuqCb0yEDsxJcCVX4GmDok5KMHm/E2bgjpRjVRxZ+mrnLqTSwojt0LXg61vv8dNF8QD4sngPXqhmKQ7yp5O6S8ygn4lIPaUGOl5cgX1HsB3Q9Pfv3sg4A==&Version=2012-11-05
In the response, Postman shows the ‘+’ being replaced with spaces, so assume this is an encoding problem:
The input receipt handle "AQEBjiliZegyBS/ZO9wta a/heA/tSx/f6tLFqfH38jEZ2r9zguHAljXhG/B8tXaM S6MKs/XGyZ206S3NC2V38CUKLO sPF0mfP47wqu7 nAIwettlxTGQAYuCFqI1CYBYHXxgajB1UEiFz8Kc6v8SlWs/VPLX IWjckoQOtMRl977sxM5pCLhMNvIwh1RYFvybM0D0WEbJEuYb9JU3DZuRZg/K5rjvNooPqER4FR1JJxpZiJ0tu6481CyePLtEh/J4 Yd2kYRyuqN788oEdSTZIKprA6lHUCiCmeuqCb0yEDsxJcCVX4GmDok5KMHm/E2bgjpRjVRxZ mrnLqTSwojt0LXg61vv8dNF8QD4sngPXqhmKQ7yp5O6S8ygn4lIPaUGOl5cgX1HsB3Q9Pfv3sg4A==" is not a valid receipt handle.
Try #2
URL Encode the Receipt Handle:
Action=DeleteMessage&ReceiptHandle=AQEBjiliZegyBS%2FZO9wta%2Ba%2FheA%2FtSx%2Ff6tLFqfH38jEZ2r9zguHAljXhG%2FB8tXaM%2BS6MKs%2FXGyZ206S3NC2V38CUKLO%2BsPF0mfP47wqu7%2BnAIwettlxTGQAYuCFqI1CYBYHXxgajB1UEiFz8Kc6v8SlWs%2FVPLX%2BIWjckoQOtMRl977sxM5pCLhMNvIwh1RYFvybM0D0WEbJEuYb9JU3DZuRZg%2FK5rjvNooPqER4FR1JJxpZiJ0tu6481CyePLtEh%2FJ4%2BYd2kYRyuqN788oEdSTZIKprA6lHUCiCmeuqCb0yEDsxJcCVX4GmDok5KMHm%2FE2bgjpRjVRxZ%2BmrnLqTSwojt0LXg61vv8dNF8QD4sngPXqhmKQ7yp5O6S8ygn4lIPaUGOl5cgX1HsB3Q9Pfv3sg4A%3D%3D&Version=2012-11-05
Error response is:
The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
Does the receipt handle need to be encoded?
Based on SQS DeleteMessage docs, your second attempt with URL encoding the receipt handle is correct.
It looks like you're having a problem with authentication & authorization - you need to sign your requests with auth params - this is what prevents (a) others from making unauthorized requests to your account's resources, and (b) others from intercepting and modifying (or replaying) your requests to your account's resources.
This tutorial provides great details on this how to do this auth via postman:
Postman makes it easy to setup all the necessary authorization using Collections. Configure the AWS authorization in the parent collection with the Access Key and Secret Access Key found in the AWS Console:
Then reference that authorization in each request:
For full information on how to construct the auth params more manually (which AWS API will do for you by the way), see http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html

How to make GoogleCL work? Can't configure the OAuth Token

I just installed GoogleCL but can't make it work. When I enter the command it requests me a username and then the following message is shown:
Could someone show me how to get this OAuth token and what to do with it?
What I could do until now was to download a JSON file from the API Console but I don't know what to do with it.

Resources