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

Expose GSSAPI::Simple keytab #21

Merged
merged 1 commit into from
Oct 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Note that [gssapi](https://github.com/zenchild/gssapi) library must be available

client = WebHDFS::Client.new('hostname', 14000)
client.kerberos = true
client.kerberos_keytab = "/path/to/project.keytab"

## AUTHORS

Expand Down
5 changes: 3 additions & 2 deletions lib/webhdfs/client_v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ClientV1
attr_accessor :ssl
attr_accessor :ssl_ca_file
attr_reader :ssl_verify_mode
attr_accessor :kerberos
attr_accessor :kerberos, :kerberos_keytab

SSL_VERIFY_MODES = [:none, :peer]
def ssl_verify_mode=(mode)
Expand Down Expand Up @@ -51,6 +51,7 @@ def initialize(host='localhost', port=50070, username=nil, doas=nil, proxy_addre
@ssl_verify_mode = nil

@kerberos = false
@kerberos_keytab = nil
end

# curl -i -X PUT "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=CREATE
Expand Down Expand Up @@ -303,7 +304,7 @@ def request(host, port, method, path, op=nil, params={}, payload=nil, header=nil
if @kerberos
require 'base64'
require 'gssapi'
gsscli = GSSAPI::Simple.new(@host, 'HTTP')
gsscli = GSSAPI::Simple.new(@host, 'HTTP', @kerberos_keytab)
token = nil
begin
token = gsscli.init_context
Expand Down