Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error - Unauthorized when accessing from curl #12

Open
karstengresch opened this issue Apr 4, 2017 · 4 comments
Open

Error - Unauthorized when accessing from curl #12

karstengresch opened this issue Apr 4, 2017 · 4 comments

Comments

@karstengresch
Copy link

Followed the instructions from https://github.com/OpenShiftDemos/openshift-cd-demo which I finally got running locally with oc cluster up (setup and config see here: ).

Tried to create a task:

curl -i -u 'redhat:redhat1!' -H "Content-Length: 0" -X POST http://tasks-dev.apps.127.0.0.1.nip.io/ws/tasks/task1

Result:

HTTP/1.1 401 Unauthorized
Expires: 0
Cache-Control: no-cache, no-store, must-revalidate
X-Powered-By: Undertow/1
Server: JBoss-EAP/7
Pragma: no-cache
Date: Tue, 04 Apr 2017 18:37:18 GMT
WWW-Authenticate: Basic realm="RealmUsersRoles"
Content-Type: text/html;charset=UTF-8
Content-Length: 71
Set-Cookie: 5d1905427a4600d0082930fc85649db9=21c9d5dd6cefe390218571514e4c1701; path=/; HttpOnly

<html><head><title>Error</title></head><body>Unauthorized</body></html>

Just to let you know...

@karstengresch
Copy link
Author

As the md5 of redhat1! is

c4df094e0bf5bc1c471423c4f356e902

on several *ix-systems tested, I assume the password in the documentation is not correct.

@abessifi
Copy link

Same issue here!

@redlumxn
Copy link

redlumxn commented Jun 12, 2017

Found out the issue is related to the pipeline defined in cicd-template.yaml from https://github.com/OpenShiftDemos/openshift-cd-demo. The Jenkinsfile 'Deploy DEV' stage is not placing creating the configuration directory (containing the users/roles) into the right directory structure within the oc-build directory. This is where the WAR is copied to and the configuration directory needs to be at the same level for the binary build to work as expected and place the configuration files in the right EAP_HOME/standalone/configuration directory within the container.

oc-build
----ROOT.war
----configuration
--------application-roles.properties
--------application-users.properties

I simply changed the Jenkinsfile DEV stage from:

stage ('Deploy DEV') {
     sh "rm -rf oc-build && mkdir -p oc-build/deployments"
     sh "cp target/openshift-tasks.war oc-build/deployments/ROOT.war"
     sh "oc project ${DEV_PROJECT}"

to

stage ('Deploy DEV') {
     sh "rm -rf oc-build && mkdir -p oc-build/configuration"
     sh "cp target/openshift-tasks.war oc-build/ROOT.war"
     sh "cp configuration/*.properties oc-build/configuration"
     sh "oc project ${DEV_PROJECT}"

Hope this helps

@rafaeltuelho
Copy link

@redlumxn send a PR for this! ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants