# AbstractAuthMethod (sshj 0.4.0 API)
Date: 2011-06-06

## net.schmizz.sshj.userauth.method
Class AbstractAuthMethod

    java.lang.Object
      net.schmizz.sshj.userauth.method.AbstractAuthMethod

All Implemented Interfaces:
  SSHPacketHandler, AuthMethod

Direct Known Subclasses:
  AuthKeyboardInteractive, AuthNone, AuthPassword, KeyedAuthMethod

    public abstract class AbstractAuthMethod

extends Object
implements AuthMethod

This abstract class for `AuthMethod` implements common or default functionality.

Field Summary
`protected org.slf4j.Logger` `log` Logger
`protected AuthParams` `params` `AuthParams` useful for building request.

Constructor Summary
`protected` `AbstractAuthMethod(String name)`

Method Summary
`protected SSHPacket` `buildReq()` Builds a `SSHPacket` containing the fields common to all authentication method.
`String` `getName()`
`void` `handle(Message msg, SSHPacket buf)` Delegate handling of some SSH packet to this object.
`void` `init(AuthParams params)` This method must be called before requesting authentication with this method.
`protected AccountResource` `makeAccountResource()`
`void` `request()`
`boolean` `shouldRetry()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected final org.slf4j.Logger log

  Logger

### params

    protected AuthParams params

  `AuthParams` useful for building request.

Constructor Detail

### AbstractAuthMethod

    protected AbstractAuthMethod(String name)

Parameters:
  `name` - the `name` of this authentication method.

Method Detail

### getName

    public String getName()

  Specified by:
    `getName` in interface `AuthMethod`
  Returns:
    assigned name of this authentication method

### handle

    public void handle(Message msg,
                       SSHPacket buf)
                throws UserAuthException,
                       TransportException

  Description copied from interface: `SSHPacketHandler`
  Delegate handling of some SSH packet to this object.

  Specified by:
    `handle` in interface `SSHPacketHandler`
  Parameters:
    `msg` - the SSH `message identifier`
    `buf` - `SSHPacket` containing rest of the request
  Throws:
    `UserAuthException`
    `TransportException`

### init

    public void init(AuthParams params)

  Description copied from interface: `AuthMethod`
  This method must be called before requesting authentication with this method.

  Specified by:
    `init` in interface `AuthMethod`
  Parameters:
    `params` - parameters needed for authentication

### request

    public void request()
                 throws UserAuthException,
                        TransportException

  Specified by:
    `request` in interface `AuthMethod`
  Throws:
    `UserAuthException` - if there is an error with the request
    `TransportException` - if there is a transport-related error

### shouldRetry

    public boolean shouldRetry()

  Specified by:
    `shouldRetry` in interface `AuthMethod`
  Returns:
    whether authentication should be reattempted if it failed.

### buildReq

    protected SSHPacket buildReq()
                          throws UserAuthException

  Builds a `SSHPacket` containing the fields common to all authentication method. Method-specific fields can further be put into this buffer.

  Throws:
    `UserAuthException`

### makeAccountResource

    protected AccountResource makeAccountResource()

Copyright © 2009-2011. All Rights Reserved.