1Net::SSH::Perl::Auth(3)User Contributed Perl DocumentatioNnet::SSH::Perl::Auth(3)
2
3
4
6 Net::SSH::Perl::Auth - Base authentication class, plus utility methods
7
9 use Net::SSH::Perl::Cipher;
10
11 # Get list of supported authentication IDs.
12 my $supported = Net::SSH::Perl::Auth::supported();
13
14 # Translate an auth name into an ID.
15 my $id = Net::SSH::Perl::Auth::id($name);
16
17 # Translate an auth ID into a name.
18 my $name = Net::SSH::Perl::Auth::name($id);
19
20 # Get the order in which auth methods are tested.
21 my $order = Net::SSH::Perl::Auth::order();
22
24 Net::SSH::Perl::Auth provides a base class for each of the authentica‐
25 tion method classes. In addition, it defines a set of utility methods
26 that can be called either as functions or object methods.
27
29 supported( [ $auth_id [, $server_supports ] ])
30
31 Without arguments, returns a reference to an array of auth methods sup‐
32 ported by Net::SSH::Perl. These are methods that have working
33 Net::SSH::Perl::Auth:: implementations, essentially.
34
35 With one argument $auth_id, returns a true value if that auth method is
36 supported by Net::SSH::Perl, and false otherwise.
37
38 With two arguments, $auth_id and $server_supports, returns true if the
39 auth represented by $auth_id is supported both by Net::SSH::Perl and by
40 the sshd server. The list of methods supported by the server should be
41 in $server_supports, a bit mask sent from the server during the session
42 identification phase.
43
44 Can be called either as a non-exported function, i.e.
45
46 my $i_support = Net::SSH::Perl::Auth::supported();
47
48 or as an object method of a Net::SSH::Perl::Auth object, or an object
49 of a subclass (in which case the first argument should be $server_sup‐
50 ports, not the $auth_id):
51
52 if ($auth->supported($server_supports)) {
53 print "Server supports auth method $auth";
54 }
55
56 id( [ $auth_name ] )
57
58 Translates an auth method name into an ID (suitable for sending to the
59 sshd server, for example).
60
61 If given $auth_name translates that name into the corresponding ID. If
62 called as an object method, translates the object's auth class name
63 into the ID.
64
65 name( [ $auth_id ] )
66
67 Translates an auth method ID into a name.
68
69 If given $auth_id translates that ID into the corresponding name. If
70 called as an object method, returns the (stripped) object's auth class
71 name; for example, if the object were of type
72 Net::SSH::Perl::Auth::Rhosts, name would return Rhosts.
73
74 auth_order()
75
76 Returns a reference to an array containing auth method IDs. These IDs
77 describe the order in which authentication should be tested against the
78 server. So, for example, if the array listed (2, 4, 3), then the client
79 should test: RSA, then Rhosts-RSA, then Password authentication.
80
82 Net::SSH::Perl::Auth->new($auth_name, $ssh)
83
84 Instantiates a new auth object of the type $auth_name, and gives it the
85 Net::SSH::Perl object $ssh, which should contain an open connetion to
86 an sshd server.
87
88 Returns the auth object, which will be blessed into the actual auth
89 subclass.
90
91 $valid = $auth->authenticate()
92
93 Talks to the sshd server to authenticate the user; if valid, returns
94 true, and if invalid, returns false.
95
97 Classes implementing an authentication method must implement the fol‐
98 lowing two methods:
99
100 * $class->new($ssh)
101 Given a Net::SSH::Perl object $ssh, should construct a new auth
102 object and bless it into $class, presumably.
103
104 * $class->authenticate()
105 Authenticate the current user with the remote daemon. This requires
106 following the messaging protocol defined for your authentication
107 method. All of the data you need--user name, password (if
108 required), etc.--should be in the $ssh object.
109
110 Returns 1 if the authentication is successful, 0 otherwise.
111
113 Please see the Net::SSH::Perl manpage for author, copyright, and
114 license information.
115
116
117
118perl v5.8.8 2003-12-03 Net::SSH::Perl::Auth(3)