Hello,On 20/10/2009, at 5:08 PM, Dikang Gu wrote:Hi Arjuna,Thank you for your information!Yes, I have converted the ruby authenticate code to java, and used the cookie in subsequent calls to Chef Server, but I still have the 401 error. I attach some of the debug log, could you help me to talk a look at it, please?ThanksDikang{snip}Can you please post the chef-server logs in debug mode (-l debug or log_level :debug in server.rb) showing the auth/authz failure :)The default location is /var/log/chef/server.logOn Tue, Oct 20, 2009 at 11:54 AM, Arjuna Christensen < " target="_blank"> > wrote: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-76def 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 })endShouldn'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 < " target="_blank"> > 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?ThanksDikangOn 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">
Archive powered by MHonArc 2.6.16.