Class: Net::SSH::Kerberos::Context
- Inherits:
-
Object
- Object
- Net::SSH::Kerberos::Context
- Defined in:
- lib/net/ssh/kerberos/context.rb
Direct Known Subclasses
Defined Under Namespace
Classes: GeneralError, State
Instance Attribute Summary collapse
-
#cred_krb_name ⇒ Object
readonly
Returns the value of attribute cred_krb_name.
-
#cred_name ⇒ Object
readonly
Returns the value of attribute cred_name.
-
#server_krb_name ⇒ Object
readonly
Returns the value of attribute server_krb_name.
-
#server_name ⇒ Object
readonly
Returns the value of attribute server_name.
Instance Method Summary collapse
- #create(user, host) ⇒ Object
- #credentials? ⇒ Boolean
- #dispose ⇒ Object
- #established? ⇒ Boolean
- #get_mic(token) ⇒ Object
- #init(token = nil) ⇒ Object
-
#initialize ⇒ Context
constructor
A new instance of Context.
Constructor Details
Instance Attribute Details
#cred_krb_name ⇒ Object (readonly)
Returns the value of attribute cred_krb_name.
11 12 13 |
# File 'lib/net/ssh/kerberos/context.rb', line 11 def cred_krb_name @cred_krb_name end |
#cred_name ⇒ Object (readonly)
Returns the value of attribute cred_name.
11 12 13 |
# File 'lib/net/ssh/kerberos/context.rb', line 11 def cred_name @cred_name end |
#server_krb_name ⇒ Object (readonly)
Returns the value of attribute server_krb_name.
11 12 13 |
# File 'lib/net/ssh/kerberos/context.rb', line 11 def server_krb_name @server_krb_name end |
#server_name ⇒ Object (readonly)
Returns the value of attribute server_name.
11 12 13 |
# File 'lib/net/ssh/kerberos/context.rb', line 11 def server_name @server_name end |
Instance Method Details
#create(user, host) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/net/ssh/kerberos/context.rb', line 17 def create(user, host) dispose if @credentials or @target or @handle creds, name = acquire_current_credentials begin @cred_name = name.to_s.sub(/^[^\\\/]*[\\\/]/, '') @cred_krb_name = @cred_name.gsub('@', '/'); z = (user.include?('@') ? user.gsub('@','/') : user+'/') unless z.downcase == @cred_krb_name[0,z.length].downcase raise GeneralError, "Credentials mismatch: current is #{@cred_name}, requested is #{user}" end @credentials = creds ensure if @credentials.nil? release_credentials creds @cred_name = @cred_krb_name = nil end end @server_name = Socket.gethostbyname(host)[0] @target, @server_krb_name = import_server_name host true end |
#credentials? ⇒ Boolean
43 |
# File 'lib/net/ssh/kerberos/context.rb', line 43 def credentials?; ! @credentials.nil? end |
#dispose ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/net/ssh/kerberos/context.rb', line 51 def dispose @handle and delete_context @handle @credentials and release_credentials @credentials @target and release_server_name @target ensure @credentials = @cred_name = @cred_krb_name = nil @target = @server_name = @server_krb_name = nil @handle = @state = nil end |
#established? ⇒ Boolean
45 |
# File 'lib/net/ssh/kerberos/context.rb', line 45 def established?; ! @handle.nil? && (@state.nil? || @state.complete?) end |
#get_mic(token) ⇒ Object
49 |
# File 'lib/net/ssh/kerberos/context.rb', line 49 def get_mic(token); raise NotImplementedError, "subclasses must implement this method" end |
#init(token = nil) ⇒ Object
47 |
# File 'lib/net/ssh/kerberos/context.rb', line 47 def init(token=nil); raise NotImplementedError, "subclasses must implement this method" end |