unable to publish result to pact broker - post

I am trying to publish verification result on pact broker host on localhost:9292 using the below command:
curl -XPOST -H 'Content-Type: application/json' -d#/home/ec2-user/pact-ruby/example/zoo-app/spec/pacts/zoo_app-animal_service.json ${verification_url}
Here , i am unable to fetch the value of verification url from below syntax.
BASE_URL="http://localhost:9292"
response_body=$(curl ${BASE_URL}/pacts/provider/Bar/consumer/Foo/latest)
verification_url=$(echo "${response_body}" | ruby -e "require 'json'; puts JSON.parse(ARGF.read)['_links']['pb:publish-verification-results']['href']")
curl -XPOST -H 'Content-Type: application/json' -d#script/foo-bar-verification.json ${verification_url}
Currently i have performed verification at the below url:
../animal-service > specs/service_consumers> rake:pact-verify-at[].
i am unable to figure out how will i retrieve the verification url from the above request. what am i missing, please help.

There are two ways Provider can verify published pact from Pact Broker.
A webhook 'contract content changed' is setup on Pact Broker itself that calls Provider's verification build by passing ${pactbroker.pactUrl} to it.
The Broker requires you to assign a consumer version ${commit_hash} for every contract you publish. When running a provider verification the provider needs to specify the consumer version it wants to verify. The broker will then return the latest version of the contracts for that specific consumer version.

Related

Error in triggering jenkins job from Slack

I am integrating Jenkins in Slack to facilitate build from Slack.
I configured the Build Trigger section of my job
Then I added Slash Commands to slack and configured it as below.
Now, I went to slack and typed /dev-backend, and it is throwing the error,
/dev-backend failed with the error "invalid_url"
I tried hitting the URL directly from postman which is giving the Authentication required response.
How can I add the authentication so that I can trigger build from slack? I thought the token provided in the build triggers section of Jenkins was enough.
I know it's kind of outdated question but I was also struggling with this error, so maybe it will help someone in the future. If you are getting /command failed with the error "invalid_url" and you are able to hit your application endpoint via eg. Bash shell:
curl -X POST -H 'Authorization: Bearer your-bearer-token' -H 'Content-type: application/json;charset=utf-8' --data '{"channel":"#test","text":"Hello, Slack!"}' http://127.0.0.1:8000/your/application/endpoint
it means that Slack can't access/see the URL that you passed in Slack API Applications Settings.
In my case the problem was that I was passing http://127.0.0.1:8000/some/endpoint in Slash Commands configuration which was visible only by my computer. The easiest way to make it visible for Slack is to use ngrok.
So if you are getting this error the steps are as follows:
Install ngrok
Run your app on localhost, eg. http://127.0.0.1:8000
In Bash shell type ngrok http 8000
Copy url returned by ngrok, in my case http://c609-91-234-49-229.ngrok.io
Paste copied URL to Slack Slash Commands configuration instead of localhost.

Introspection Endpoint of KeyCloak server

I am trying to explore features of KeyCloak server and want to get information about access token by using /openid-connect/token/introspect endpoint.
So, I am sending next request to this endpoint
curl -v --data "token_type_hint=access_token&client_id=product-
app&username=user&token=MY ACCESS TOKEN"
http://localhost:8080/auth/realms/springdemo/protocol/openid-
connect/token/introspect
So this is what I have as a response:
{"error":"invalid_request","error_description":"Client not allowed."}*
Connection #0 to host localhost left intact
and this is what I see in KeyCloak's logs:
12:00:18,045 WARN [org.keycloak.events] (default task-13)
type=INTROSPECT_TOKEN _ERROR,
realmId=springdemo, clientId=product-app, userId=null, ipAddress=127.0.0
.1, error=invalid_request, detail='Client not allowed.',
client_auth_method=client-secret
So, I can't get it - how should I properly make request to keycloak in this case regarding that product-app has public access. Please, explain!
It seems like you are not able to use /openid-connect/token/introspect endpoint when your client has public access type.
So, switch to the CONFIDENTIAL ACCESS TYPE and use
curl -v --data "client_secret=YOUR_SECRET9&client_id=product-
app&username=user&token=YOUR_TOKEN"
http://localhost:8080/auth/realms/springdemo/protocol/openid-
connect/token/introspect
It works fine.

Connection refused in wso2 playground2 sample

I am doing playground2 sample of wso2 from this post. It is generating access token but having problem when I am accessing UserInfo.
It's saying connection refused. I am using wso2is-5.0.0
thank you
You can also use below curl command for call userinfo endpoint and if you need more details you can use this URL.
curl -k -H "Authorization: Bearer <paste_access_token>" https://localhost:9443/oauth2/userinfo?schema=openid
Plus you need to adding claims in OAuth service provider side and get more details in this offcial WSO2 document.

How to generate an Access token for implicit flow in IBM API Management Beta

I'm working on OAuth implicit flow implementation with IBM API Management Beta version.Can anyone please tell me what is the process for generating an access token with an example or do I need to use curl command for access token ??? Any clear steps to follow OAuth implementation in IBM APIM Beta using any security scheme either Application flow/Implicit/Password flow is also helpful.
follow these curl for password flow:
1.) curl -k -X POST -d "grant_type=password&&scope=your_API_scope&username=your_IBM_APIM_username&password=your_IBMAPIM_password&client_id=client_id" "token_endpoint_url"
it gives access token ...copy the access token and save it in notepad.
2.) curl -k -H "Authorization : Bearer your_Access_token" -X GET "api_url&client_id=a30124a6-6757-48d6-b979-cf11b701c72a"
gives you data.

oauth not found on Umbraco.Web.Editors.BackOfficeController with v7.4.1

I use VisualStudio v14, recently upgraded to 7.4.1 via the NuGet package manager and Umbraco is now returning a server error page "Server Error in '/' Application" - replying with a 404 for "/umbraco/oauth/token" when I make token requests. The error also states, A public action method 'oauth' was not found on controller 'Umbraco.Web.Editors.BackOfficeController'.
I had the base Umbraco RestApi configuration working just fine in my previous installation of 7.3.8.
I have uninstalled and reinstalled the Umbraco RestApi and IdentityExtensions, validated my configurations in both Web.config and UmbracoStandardOwinStartup.cs, rebuilt my site and still getting a 404 server error. I have also validated that my UrlRewriting.config is not interfering with the request
Here is the token request I use:
curl -X POST -H "Accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -H "Cache-Control: no-cache" -d 'grant_type=password&username=admin&password=pwd' http://localhost:12345/umbraco/oauth/token
Does anyone have any suggestions how I can debug, or better yet a solution for me?
Token authorization using the /umbraco/oauth/token service path requires a HTTPS protocol. Even though Production and/or enterprise managed servers have SSL properly configured, our PDEs seldom are.
Here's what I did to enable SSL in my Visual Studio 2015 .NET 4.5.2 web site project for my Umbraco instance.
In the *.csproj file find the node: <IISExpressSSLPort /> and change it to: <IISExpressSSLPort>44300</IISExpressSSLPort> FYI - the port number must be between 44300 and 44399 and make sure these ports are open on your PDE. Visual Studio will prompt you to make some determinations about it's behavior towards this new SSL configuration and future SSL configurations, so those determinations are up to you.
So here's a working request for a token from the localhost:
curl -X POST -H "Accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -H "Cache-Control: no-cache" -d 'grant_type=password&username=######&password=******' -k https://localhost:44300/umbraco/oauth/token
Notice the -k flag.
Because I opted to install a local SSL generated by VS, the verification by curl fails, so the -k flag is used to disable the verification for the current request.
I hope this helps anyone who stumbles upon this thread! Good luck!

Resources