| 1 | # ===================================================================== | ||
| 2 | # Copyright (c) 2002,2003 IBM Corporation | ||
| 3 | # All rights reserved. This program and the accompanying materials | ||
| 4 | # are made available under the terms of the Common Public License v1.0 | ||
| 5 | # which accompanies this distribution, and is available at | ||
| 6 | # http://www.opensource.org/licenses/cpl.php | ||
| 7 | # | ||
| 8 | # ===================================================================== | ||
| 9 | |||
| 10 | package LS::Client; | ||
| 11 | |||
| 12 | use strict; | ||
| 13 | use warnings; | ||
| 14 | |||
| 15 | use vars qw( $METHODS ); | ||
| 16 | |||
| 17 | use LS; | ||
| 18 | |||
| 19 | use base 'LS::Base'; | ||
| 20 | |||
| 21 | sub BEGIN { | ||
| 22 | |||
| 23 | $METHODS = [ | ||
| 24 | 'credentials', | ||
| 25 | ]; | ||
| 26 | |||
| 27 | LS::makeAccessorMethods($METHODS, __PACKAGE__); | ||
| 28 | } | ||
| 29 | |||
| 30 | # | ||
| 31 | # credentials( $crd_object ) - Sets/Gets the credentials object specified by crd_object. | ||
| 32 | # If crd_object is omitted, the current credentials are | ||
| 33 | # returned. | ||
| 34 | # | ||
| 35 | |||
| 36 | |||
| 37 | |||
| 38 | package LS::Client::Credentials; | ||
| 39 | |||
| 40 | use strict; | ||
| 41 | use warnings; | ||
| 42 | |||
| 43 | |||
| 44 | # | ||
| 45 | # new - | ||
| 46 | # | ||
| 47 | # Parameters: | ||
| 48 | # | ||
| 49 | # Returns: | ||
| 50 | # | ||
| 51 | sub new { | ||
| 52 | |||
| 53 | my $self = shift; | ||
| 54 | |||
| 55 | my (%options) = @_; | ||
| 56 | |||
| 57 | unless(ref $self) { | ||
| 58 | |||
| 59 | $self = bless { | ||
| 60 | |||
| 61 | _username=> undef, | ||
| 62 | _password=> undef, | ||
| 63 | }, $self; | ||
| 64 | |||
| 65 | $self->username( $options{'username'} ); | ||
| 66 | $self->password( $options{'password'} ); | ||
| 67 | } | ||
| 68 | |||
| 69 | return $self; | ||
| 70 | } | ||
| 71 | |||
| 72 | |||
| 73 | # | ||
| 74 | # username( $username ) - Sets/Gets the username portion of these credentials | ||
| 75 | # | ||
| 76 | # Parameter: If present, becomes the username of the object | ||
| 77 | # | ||
| 78 | # Returns: The username of this object | ||
| 79 | # | ||
| 80 | sub username { | ||
| 81 | |||
| 82 | my $self = shift; | ||
| 83 | |||
| 84 | @_ ? $self->{'_username'} = shift : $self->{'_username'}; | ||
| 85 | } | ||
| 86 | |||
| 87 | |||
| 88 | # | ||
| 89 | # password ( $password ) - Sets/Gets the password portion of these credentials | ||
| 90 | # | ||
| 91 | # Parameter: If present, becomes the password of the object | ||
| 92 | # | ||
| 93 | # Returns: The password of this object | ||
| 94 | # | ||
| 95 | sub password { | ||
| 96 | |||
| 97 | my $self = shift; | ||
| 98 | |||
| 99 | @_ ? $self->{'_password'} = shift : $self->{'_password'}; | ||
| 100 | } | ||
| 101 | |||
| 102 | 1; | ||
| 103 | |||
| 104 | __END__ |