Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jdesktop.swingx.auth
Class LoginService

    java.lang.Object
      org.jdesktop.beans.AbstractBean
          org.jdesktop.swingx.auth.LoginService

Direct Known Subclasses:
  JAASLoginService, JDBCLoginService, SimpleLoginService

    public abstract class LoginService

extends AbstractBean

LoginService is the abstract base class for all classes implementing a login mechanism. It allows you to customize the threading behaviour used to perform the login. Subclasses need to override the authenticate method. Subclasses may implement the getUserRoles() method to return a meaningful value this method will be called once upon a successful login to determine the user roles. It is not defined as abstract to simplify the task of implementing a login service for those who do not require this functionality.

Author:
  Bino George, Shai Almog, Karl Schaefer

Constructor Summary
`LoginService()`
`LoginService(java.lang.String server)`

Method Summary
`void` | `addLoginListener(LoginListener listener)` Adds a LoginListener to the list of listeners
`abstract boolean` | `authenticate(java.lang.String name, char[] password, java.lang.String server)` This method is intended to be implemented by clients wishing to authenticate a user with a given password.
`void` | `cancelAuthentication()` Notifies the LoginService that an already running authentication request should be cancelled.
`java.lang.String` | `getServer()`
`boolean` | `getSynchronous()` Get the synchronous property
`java.lang.String[]` | `getUserRoles()` Called immediately after a successful authentication.
`void` | `removeLoginListener(LoginListener listener)` Removes a LoginListener from the list of listeners
`void` | `setServer(java.lang.String server)`
`void` | `setSynchronous(boolean synchronous)` Sets the synchronous property
`void` | `startAuthentication(java.lang.String user, char[] password, java.lang.String server)` This method starts the authentication process and is either synchronous or asynchronous based on the synchronous property

Methods inherited from class org.jdesktop.beans.AbstractBean
`addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener`

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

Constructor Detail

### LoginService

    public LoginService()

### LoginService

    public LoginService(java.lang.String server)

Method Detail

### authenticate

    public abstract boolean authenticate(java.lang.String name,
                                         char[] password,
                                         java.lang.String server)
                                  throws java.lang.Exception

  This method is intended to be implemented by clients wishing to authenticate a user with a given password. Clients should implement the authentication in a manner that the authentication can be cancelled at any time.

  Parameters:
    `name` - username
    `password` - password
    `server` - server (optional)
  Returns:
    `true` on authentication success
  Throws:
    `java.lang.Exception`

### getUserRoles

    public java.lang.String[] getUserRoles()

  Called immediately after a successful authentication. This method should return an array of user roles or null if role based permissions are not used.

  Returns:
    per default `null`

### cancelAuthentication

    public void cancelAuthentication()

  Notifies the LoginService that an already running authentication request should be cancelled. This method is intended to be used by clients who want to provide user with control over cancelling a long running authentication request.

### startAuthentication

    public void startAuthentication(java.lang.String user,
                                    char[] password,
                                    java.lang.String server)
                             throws java.lang.Exception

  This method starts the authentication process and is either synchronous or asynchronous based on the synchronous property

  Parameters:
    `user` - user
    `password` - password
    `server` - server
  Throws:
    `java.lang.Exception`

### getSynchronous

    public boolean getSynchronous()

  Get the synchronous property

  Returns:
    the synchronous property

### setSynchronous

    public void setSynchronous(boolean synchronous)

  Sets the synchronous property

  Parameters:
    `synchronous` - synchronous property

### addLoginListener

    public void addLoginListener(LoginListener listener)

  Adds a LoginListener to the list of listeners

  Parameters:
    `listener` - listener

### removeLoginListener

    public void removeLoginListener(LoginListener listener)

  Removes a LoginListener from the list of listeners

  Parameters:
    `listener` - listener

### getServer

    public java.lang.String getServer()

  Returns:
    Returns the server.

### setServer

    public void setServer(java.lang.String server)

  Parameters:
    `server` - The server to set.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010. All Rights Reserved.