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

When using certificate based authentication org_admin is not defined. #200

Open
mkanoor opened this issue Jun 19, 2020 · 0 comments
Open

Comments

@mkanoor
Copy link
Contributor

mkanoor commented Jun 19, 2020

A system user has limited privileges and can do very limited operations.

The payload looks like this

{
  "identity"=>{
    "internal"=>{
      "org_id"=>"1111111",
      "auth_time"=>0
    },
    "account_number"=>"123456",
    "auth_type"=>"cert-auth",
    "system"=>{
      "cn"=>"cafebaba-5999-42b4-8e54-facade70beef"
    },
    "type"=>"System"
  },
  "entitlements"=>{
    "insights"=>{
      "is_entitled"=>true,
      "is_trial"=>false
    },
    "cost_management"=>{
      "is_entitled"=>true,
      "is_trial"=>false
    },
    "ansible"=>{
      "is_entitled"=>true,
      "is_trial"=>false
    },
    "settings"=>{
      "is_entitled"=>true,
      "is_trial"=>false
    },
    "openshift"=>{
      "is_entitled"=>true,
      "is_trial"=>false
    },
    "smart_management"=>{
      "is_entitled"=>true,
      "is_trial"=>false
    },
    "subscriptions"=>{
      "is_entitled"=>true,
      "is_trial"=>false
    },
    "migrations"=>{
      "is_entitled"=>true,
      "is_trial"=>false
    }
  }
}

So any code that tries to check org_admin for a cert based authentication like here will fail.
https://github.com/RedHatInsights/sources-api/blob/7365c17b76fdf937ebcecf60705ba9cf75987824/app/controllers/application_controller.rb#L100

Will raise an exception from here

raise IdentityError, "#{key} doesn't exist" if result.nil?

@mkanoor mkanoor changed the title When using certificate base authentication org_admin is not defined. When using certificate based authentication org_admin is not defined. Jun 19, 2020
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

1 participant