AFS

 view release on metacpan or  search on metacpan

pod/v2/afsperlktct.pod  view on Meta::CPAN

  print "String     = ", $token->string, "\n";

  my $index = 0;
  my $service = AFS::KTC_PRINCIPAL->ListTokens($index);
  print "service = ", $service->principal, "\n";
  ($token, my $user) = AFS::KTC_TOKEN->GetToken($service);
  print "  client     = ", $user -> principal, "\n";
  print "  StartTime  = ", $token->startTime, "\n";
  print "  EndTime    = ", $token->endTime, "\n";
  print "  SessionKey = ", $token->sessionKey, "\n";
  print "  Kvno       = ", $token->kvno, "\n";
  print "  TicketLen  = ", $token->ticketLen, "\n";
  print "  Ticket     = ", $token->ticket, "\n";
  print "  String     = ", $token->string, "\n";

  $service = AFS::KTC_PRINCIPAL->new("afs","",localcell);
  ($token, $user) = AFS::KTC_TOKEN->GetToken($service);
  AFS::KTC_TOKEN->ForgetAllTokens();
  AFS::KTC_TOKEN->SetToken($service, $token, $user, 0);

  my $string = $token->string;
  $token = AFS::KTC_TOKEN->FromString($string);
  print "  StartTime  = ", $token->startTime, "\n";
  print "  EndTime    = ", $token->endTime, "\n";

  my $user = AFS::KTC_PRINCIPAL->new('nog','',localcell);
  my $key  = AFS::KTC_EKEY->ReadPassword('nog Password:');
  my $ok   = AFS::KTC_TOKEN->GetAuthToken($user, $key, 600);

  $service = AFS::KTC_PRINCIPAL->new("afs","",localcell);
  $token   = AFS::KTC_TOKEN->GetServerToken($service, 600, 1);

  $user  = AFS::KTC_PRINCIPAL->new('nog','',localcell);
  $key   = AFS::KTC_EKEY->ReadPassword('nog Password:');
  $token = AFS::KTC_TOKEN->GetAdminToken($user, $key, 300);

  $user     = AFS::KTC_PRINCIPAL->new('nog');
  $password = AFS::KTC_EKEY->UserReadPassword("Password:");

  my $pwexp  = 0;
  my $reason = '';
  $ok = AFS::KTC_TOKEN->UserAuthenticateGeneral($user, $password, 300,
            &AFS::KA_USERAUTH_VERSION | &AFS::KA_USERAUTH_DOSETPAG, $pwexp, $reason);

  AFS::KTC_TOKEN->ForgetAllTokens();

=head1 DESCRIPTION

This class provides methods to handle the B<AFS structure ktc_token>.
This structure contains information about tokens and is used in
the I<Kernel Token Cache> (KTC), which is part of the Cache Manager.

It is used to create, modify, and retrieve B<ktc_token> instances for
different services.  It has methods to retrieve and to reset the
B<ktc_token> attributes.  In order to make proper usage of these methods
it is necessary to have access to AFS::KTC_PRINCIPAL objects and to
AFS::KTC_EKEY objects.

=head1 COMPATIBILITY

B<This release does NOT support any features and interfaces
from version 1.>

=head1 OBJECT ATTRIBUTES

=over 4

=item B<startTime>

Starting date of the token.

=item B<endTime>

Expiration date of the token.

=item B<sessionKey>

Session encryption key of the token.

=item B<kvno>

Key version number associated with the Session encryption key.

=item B<ticketLen>

The length in bytes of the data stored in the attribute 'ticket'.

=item B<ticket>

The server ticket to use for the principal.

=back

=head1 METHODS

=over 4

=item B<CONSTRUCTOR>

=item S< >

=item B<$ok = AFS::KTC_TOKEN-E<gt>GetAuthToken(USER, EKEY, LIFE [, PWEXP]);>

Creates a token for the service KA_TICKET_GRANTING_SERVICE (a ticket
granting ticket, TGT) for a particular USER and saves it in the memory
(kernel token cache).  EKEY contains the user's encryption key and
LIFE indicates how long the token will be valid (in seconds, given in
5 minute intervals).  If PWEXP (default -1) is given it returns the
number of days till the password expires. USER must be an instance of
AFS::KTC_PRINCIPAL and EKEY an instance of AFS::KTC_EKEY. B<This
method must be performed first before you can get any service token
(method GetServerToken)>.  This method calls the AFS system library
function 'ka_GetAuthToken'.

=item B<$token = AFS::KTC_TOKEN-E<gt>GetServerToken(SERVICE, LIFE [, NEWTK]);>

Returns a token for the specified SERVICE.  LIFE indicates how long
the token will be valid (in seconds, given in 5 minute intervals). If
NEWTK is set to 1 (default), then the function should get a new token
if necessary. SERVICE must be an instance of AFS::KTC_PRINCIPAL.  It
requires that you already possess a TGT (method GetAuthToken).  It

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.308 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )