How to debug HTTP headers of request/responses performed during SBT publish? - sbt

I'm trying to find out why I can't publish scala packages to a Maven repository (Azure Artifacts, see https://github.com/sbt/sbt/issues/5483)
I'm receiving a 203 HTTP code which causes SBT to fail the publish task.
I'm hoping to get additional info by inspecting the Warning HTTP header that - hopefully - Microsoft has added to the HTTP response but can't figure out how to configure SBT to print them on the console (setting logLevel := Level.Debug didn't help)

The error 203: Non-Authoritative Information seems like a authorization issue.
Please try encoding your PAT to base64 format to use Basic Authentication. Please check below example to get the BASE64 authorization with PAT in powershell script.
$PAT="***"
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($PAT)"))
Please check out this similar thread, and this thread to get a correct basic authorization string
Hope above helps!

Related

tomcat and springMVC

Like the tutorial, I deployed the tomcat server step by step, and then used postman to test the back-end login function interface, but kept reporting errors, and at the end of the terminal it printed out :
Having failed to acquire a resource, com.mchange.v2.resourcepool. BasicResourcePool#2bda742d is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
The complete output in the terminal in idea is:
enter image description here
the error on postman show that:
enter image description here
it was just download all the time and have no result, and I can ensure the url is right.
I will appreciate it if you can answer me.
It seems that the password of the database root account was wrong, maybe you should check your configuration file.

Cannot publish from SBT

I am trying unsuccessfully to publish from SBT into a Nexus repository running on my network. Attempts to publish fail with a forbidden error
If I look at the Nexus side of things with trace debugging on, I can see the request, but there is no Authorization header in the request.
This is my build.sbt
And this is my credentials file
I have used curl to see what the Realm should be, which hopefully I have reflected in my credentials file
But nothing I do seems to get the Authorization header in the PUT request. Is there something obvious I am missing? I feel like I am spinning my wheels.
Thanks for any help
This did end up being how I had set up my files. My build.sbt file was fine. However, in my credentials, my Host value contains a port, which was confusing the IvyAuthenticator. I ended up seeing this error message when running through sbt shell in IntelliJ
My issue was that, in my credentials file, my host ended with the ":8081" value, and it looks like IvyAuthenticator was using the host name without the port information.
So, after updating my credentials file, so that the host value was just the machine name without any port details, my publish succeeded.

Decode JWT token on nginx server and log it

We are using nginx server for reverse proxying few micro-services. Every request has Authorization header containing JWT token. Now, what we need to do is extract user details from JWT token and log it on nginx server. Is there anyway to decode and log JWT? I looked into few lua scripts for authenticating request using JWT but that is not what we need. Also, we are trying to avoid using installing Lua on nginx server.
Any help would be greatly appreciated.
EDIT: We are fine with Lua based solution as well.
Relating to your problem and following the comments you could use the official Nginx Plus module to approach in the best way the task:
Authenticating API Clients with JWT and NGINX Plus
But this obviously cost money and in case you want something open-source you should check this project:
TeslaGov /ngx-http-auth-jwt-module
The above module, is working now a days, it's not easy as use the Nginx plus module but it's opensource.
To finish, relating to your Edition, here is a Lua solution.
ubergarm / openresty-nginx-jwt
I am not very into Lua and the project seems to be outdated due it doesn't receive an update since 2018, I share you the link in case you can found something useful from it.
I hope this helps to solve your problem, regards.

Not ablle to receive token from OAuth authentication in Apigee tool

I have created AccessTokenClientCredential and RefreshAccessToken in OAuth proxy through Apigee tool.
When I tried to access "https://damuorgn-prod.apigee.net/oauth/client_credential/accesstoken?grant_type=client_credentials&client_id=07VoDotbGhyl3aG8GxjkyXivoTNH9oiQ&client_secret=fb8ZOrAUUSGp3FAv" URL after mentioning client Id and client secret ID, page is empty. It does not displays any error or displays with Token value.
Steps followed to create token from below URL
"http://apigee.com/docs/gateway-services/content/secure-calls-your-api-through-oauth-20-client-credentials".
Please advise.
Regards,
Damodaran
I tried both Test and Prod environment but there was no luck.
I have requested for Curl software installation. Is there any other way to test this URL without Curl software. Your immediate reply is appreciated. Thanks!
Curl https://damuorgn-test.apigee.net/oauth/client_credential/accesstoken?grant_type=client_credentials -X POST -d 'client_id=qnYUqb6j3uGraRAh7JF9d651nUXNwMCC&client_secret=mjHIFMcTDCa3YQ6f'
Could you please check on this link from Curl software ?
It looks like there may be a couple of issues:
When I try your URL, I get a "CLASSIFICATION_FAILURE" error - which means the proxy can't be found. I noticed that you're using "damuorgn-prod.apigee.net" when you might have deployed your proxy to the test environment, and meant to use: "damuorgn-test.apigee.net".
In step 5.2 of the document you referenced, it says to use POST instead of GET. So you might try this:
curl https://damuorgn-test.apigee.net/oauth/client_credential/accesstoken?grant_type=client_credentials -X POST -d 'client_id=07VoDotbGhyl3aG8GxjkyXivoTNH9oiQ&client_secret=fb8ZOrAUUSGp3FAv'
(When I try this, I get an "invalid client id" error, but maybe that client_id is no longer valid?)
Hope that helps,
Scott

Gradle failing to download dependency when HEAD request fails

I have set up a dependency in my Gradle build script, which is hosted on Bitbucket.
Gradle fails to download it, with error message
Could not HEAD 'https://bitbucket.org/....zip'. Received status code 403 from server: Forbidden
I looked into it, and it seems that this is because :
Bitbucket redirects to an amazon url
the Amazon url doesn't accept HEAD requests, only GET requests
I could check that by testing that URL with curl, and I also got a 403 Forbidden when sending a HEAD request with curl.
Otherwise, it could be because Amazon doesn't accept the signature in the HEAD request, which should be different from the GET one, as explained here.
Is there a way around this ? Could I tell Gradle to skip the HEAD request, and go straight to the GET request ?
I worked around the problem by using the gradle-download-task plugin, and manually writing caching as explained here

Resources