Class: Krb5::Keytab

Inherits:
Object
  • Object
show all
Defined in:
ext/krb5_auth/keytab.c

Defined Under Namespace

Classes: Exception

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Object) Krb5Auth::Krb5::Keytab.new(name = nil)

Creates and returns a new Krb5Auth::Krb5::Keytab object. This initializes the context and keytab for future method calls on that object.

A keytab file name may be provided. If not, the system's default keytab name is used. If a name is provided it must be in the form 'type:residual' where 'type' is a type known to the Kerberos library.

Examples:

# Using the default keytab
keytab = Krb5Auth::Krb5::Keytab.new

# Using an explicit keytab
keytab = Krb5Auth::Krb5::Keytab.new('FILE:/etc/krb5.keytab')


# File 'ext/krb5_auth/keytab.c'

/*
 * call-seq:
 *   Krb5Auth::Krb5::Keytab.new(name = nil)
 *
 * Creates and returns a new Krb5Auth::Krb5::Keytab object. This initializes
 * the context and keytab for future method calls on that object.
 *
 * A keytab file +name+ may be provided. If not, the system's default keytab
 * name is used. If a +name+ is provided it must be in the form 'type:residual'
 * where 'type' is a type known to the Kerberos library.
 *
 * Examples:
 *
 *   # Using the default keytab
 *   keytab = Krb5Auth::Krb5::Keytab.new
 *
 *   # Using an explicit keytab
 *   keytab = Krb5Auth::Krb5::Keytab.new('FILE:/etc/krb5.keytab')
 */
static VALUE rkrb5_keytab_initialize(int argc, VALUE* argv, VALUE self){

Class Method Details

+ (Object) Krb5Auth::Krb5::Keytab.foreach(keytab = nil) + (Object) entry.inspect

}

Iterate over each entry in the keytab and yield a Krb5::Keytab::Entry object for each entry found.

If no keytab is provided, then the default keytab is used.



# File 'ext/krb5_auth/keytab.c'

/*
 * call-seq:
 *   Krb5Auth::Krb5::Keytab.foreach(keytab = nil){ |entry|
 *     puts entry.inspect
 *   }
 *
 * Iterate over each entry in the +keytab+ and yield a Krb5::Keytab::Entry
 * object for each entry found.
 *
 * If no +keytab+ is provided, then the default keytab is used.
 */
static VALUE rkrb5_s_keytab_foreach(int argc, VALUE* argv, VALUE klass){

Instance Method Details

- (Object) close

Close the keytab object. Internally this frees up any associated credential contents and the Kerberos context. Once a keytab object is closed it cannot be reused.



# File 'ext/krb5_auth/keytab.c'

/*
 * call-seq:
 *   keytab.close
 *
 * Close the keytab object. Internally this frees up any associated
 * credential contents and the Kerberos context. Once a keytab object
 * is closed it cannot be reused.
 */
static VALUE rkrb5_keytab_close(VALUE self){

- (Object) default_name

Returns the default keytab name.



# File 'ext/krb5_auth/keytab.c'

/*
 * call-seq:
 *
 *   keytab.default_name
 *
 * Returns the default keytab name.
 */
static VALUE rkrb5_keytab_default_name(VALUE self){

- (Object) each {|entry| ... }

Iterates over each entry, and yield the principal name.

Yields:

  • (entry)


# File 'ext/krb5_auth/keytab.c'

/*
 * call-seq:
 *
 *   keytab.each{ |entry| p entry }
 *
 * Iterates over each entry, and yield the principal name.
 *--
 * TODO: Mixin Enumerable properly.
 */
static VALUE rkrb5_keytab_each(VALUE self){

- (Object) get_entry(principal, vno = 0, encoding_type = nil)

Searches the keytab by principal, vno and encoding_type. If the vno is zero (the default), then the first entry that matches principal is returned.

Returns a Krb5Auth::Krb5::KeytabEntry object if the entry is found.

Raises an exception if no entry is found.



# File 'ext/krb5_auth/keytab.c'

/*
 * call-seq:
 *   keytab.get_entry(principal, vno = 0, encoding_type = nil)
 *
 * Searches the keytab by +principal+, +vno+ and +encoding_type+. If the
 * +vno+ is zero (the default), then the first entry that matches +principal+
 * is returned.
 *
 * Returns a Krb5Auth::Krb5::KeytabEntry object if the entry is found.
 *
 * Raises an exception if no entry is found.
 */
static VALUE rkrb5_keytab_get_entry(int argc, VALUE* argv, VALUE self){