Skip to content

Error - Unauthorized when accessing from curl #12

Open

Description

@karstengresch

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...

Activity

  1. karstengresch commented on Apr 4, 2017

    @karstengresch
    Author

    As the md5 of redhat1! is

    c4df094e0bf5bc1c471423c4f356e902

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

  2. abessifi commented on May 22, 2017

    @abessifi

    Same issue here!

  3. redlumxn commented on Jun 12, 2017

    @redlumxn

    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

  4. rafaeltuelho commented on Aug 20, 2018

    @rafaeltuelho

    @redlumxn send a PR for this! ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions