[chef] Re: Re: Re: Can i authenticate myself as an admin using the RESTful API (in java code)?


Chronological Thread 
  • From: Arjuna Christensen < >
  • To:
  • Subject: [chef] Re: Re: Re: Can i authenticate myself as an admin using the RESTful API (in java code)?
  • Date: Tue, 20 Oct 2009 16:54:49 +1300

Hi,

On 20/10/2009, at 4:37 PM, Dikang Gu wrote:

please refer to my mail: "A problem when implementing the java client of chef".

As per the Knife snippet, Chef::Rest#authenticate is called - http://github.com/opscode/chef/blob/master/chef/lib/chef/rest.rb#L65-76

    def authenticate(user, pass)
      Chef::Log.debug("Authenticating #{user} via openid")
      response = post_rest('openid/consumer/start', {
        "openid_identifier" => "#{Chef::Config[:openid_url]}/openid/server/node/#{user}",
        "submit" => "Verify"
      })
      post_rest(
        "#{Chef::Config[:openid_url]}#{response["action"]}",
        { "password" => pass }
      )
    end
Shouldn't be too hard to port that over to Java. You'll need to persist and use the cookie in subsequent authentication-required calls to the Chef Server [handled internally by Chef::Rest for the ruby client].

HTH!


On Tue, Oct 20, 2009 at 11:32 AM, Dikang Gu < "> > wrote:
Thank you Adam!

And after the authentication, will I get any information (like some tokens), that I will use in the http call?  To tell the chef-server that I have been authenticated?

Thanks 
Dikang

On Tue, Oct 20, 2009 at 2:25 AM, Adam Jacob < " target="_blank"> > wrote:
Sure - you need to just create a new client credential, and then set
it to be an administrator.

See the 'register' and 'authenticate' methods here:

http://gist.github.com/100837

Adam

On Mon, Oct 19, 2009 at 3:02 AM, Dikang Gu < " target="_blank"> > wrote:
> As per subject. So that I can do the operations just like users on the web
> UI?
> Thanks
> Dikang



--
Opscode, Inc.
Adam Jacob, CTO
T: (206) 508-7449 E: " target="_blank">



-- 
Arjuna Christensen, Software Development Engineer
Opscode, Inc.
E:  ">




Archive powered by MHonArc 2.6.16.

§