org.eclipse.net4j.util.security

## Class ChallengeNegotiator

- java.lang.Object
- - org.eclipse.net4j.util.event.Notifier
  - - org.eclipse.net4j.util.lifecycle.Lifecycle
    - - org.eclipse.net4j.util.fsm.FiniteStateMachine<STATE,EVENT,INegotiationContext>
      - - org.eclipse.net4j.util.security.Negotiator<IChallengeResponse.State,IChallengeResponse.Event>
        - - org.eclipse.net4j.util.security.ChallengeResponseNegotiator
          - - org.eclipse.net4j.util.security.ChallengeNegotiator

- All Implemented Interfaces:
    INotifier, IDeactivateable, ILifecycle, ILifecycle.DeferrableActivation, IChallengeResponse, INegotiationContext.Receiver, INegotiator

      public class ChallengeNegotiator
      extends ChallengeResponseNegotiator

  Author:
    Eike Stepper

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.eclipse.net4j.util.security.ChallengeResponseNegotiator

      `ChallengeResponseNegotiator.Transition`

    - ### Nested classes/interfaces inherited from class org.eclipse.net4j.util.fsm.FiniteStateMachine

      `FiniteStateMachine.ChangeStateTransition, FiniteStateMachine.FailTransition, FiniteStateMachine.IgnoreTransition, FiniteStateMachine.StateChangedEvent`

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.util.security.IChallengeResponse

      `IChallengeResponse.Event, IChallengeResponse.State`

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle

      `ILifecycle.DeferrableActivation`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_TOKEN_LENGTH`

    - ### Fields inherited from class org.eclipse.net4j.util.fsm.FiniteStateMachine

      `FAIL, IGNORE`

    - ### Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

      `USE_LABEL`

    - ### Fields inherited from interface org.eclipse.net4j.util.security.IChallengeResponse

      `ACKNOWLEDGE_FAILURE, ACKNOWLEDGE_SUCCESS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ChallengeNegotiator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `createChallenge(INegotiationContext context, java.nio.ByteBuffer challenge)`
    `protected byte[]` | `createRandomToken()`
    `protected void` | `doBeforeActivate()`
    `protected byte[]` | `encryptToken(java.lang.String userID, byte[] token)`
    `IRandomizer` | `getRandomizer()`
    `int` | `getTokenLength()`
    `IUserManager` | `getUserManager()`
    `protected boolean` | `handleResponse(INegotiationContext context, java.nio.ByteBuffer response)`
    `void` | `setRandomizer(IRandomizer randomizer)`
    `void` | `setTokenLength(int tokenLength)`
    `void` | `setUserManager(IUserManager userManager)`

    - ### Methods inherited from class org.eclipse.net4j.util.security.ChallengeResponseNegotiator

      `getEncryptionAlgorithmName, getEncryptionIterationCount, getEncryptionSaltBytes, getState, handleAcknowledgement, handleChallenge, setEncryptionAlgorithmName, setEncryptionIterationCount, setEncryptionSaltBytes, setState`

    - ### Methods inherited from class org.eclipse.net4j.util.security.Negotiator

      `getBufferEvent, getFailureState, getInitialState, getStartEvent, getSuccessState, handleFailure, handleSuccess, isInitiator, negotiate, postProcess, receiveBuffer`

    - ### Methods inherited from class org.eclipse.net4j.util.fsm.FiniteStateMachine

      `changeState, createFailTransition, createIgnoreTransition, formatFailMessage, formatIgnoreMessage, formatProcessMessage, getEvents, getStates, getTransition, init, init, initAll, initAll, initEvents, initEvents, initStates, initStates, process`

    - ### Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

      `activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doActivate, doAfterActivate, doBeforeDeactivate, doDeactivate, dump, getLifecycleState, isActive, isDeferredActivation, toString`

    - ### Methods inherited from class org.eclipse.net4j.util.event.Notifier

      `addListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.net4j.util.event.INotifier

      `addListener, getListeners, hasListeners, removeListener`

- - ### Field Detail

    - #### DEFAULT_TOKEN_LENGTH

          public static final int DEFAULT_TOKEN_LENGTH

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ChallengeNegotiator

          public ChallengeNegotiator()

  - ### Method Detail

    - #### getTokenLength

          public int getTokenLength()

    - #### setTokenLength

          public void setTokenLength(int tokenLength)

    - #### getRandomizer

          public IRandomizer getRandomizer()

    - #### setRandomizer

          public void setRandomizer(IRandomizer randomizer)

    - #### getUserManager

          public IUserManager getUserManager()

    - #### setUserManager

          public void setUserManager(IUserManager userManager)

    - #### doBeforeActivate

          protected void doBeforeActivate()
                                   throws java.lang.Exception

      Overrides:
        `doBeforeActivate` in class `ChallengeResponseNegotiator`
      Throws:
        `java.lang.Exception`

    - #### createRandomToken

          protected byte[] createRandomToken()

    - #### encryptToken

          protected byte[] encryptToken(java.lang.String userID,
                                        byte[] token)
                                 throws NegotiationException

      Throws:
        `NegotiationException`

    - #### createChallenge

          protected void createChallenge(INegotiationContext context,
                                         java.nio.ByteBuffer challenge)

      Overrides:
        `createChallenge` in class `ChallengeResponseNegotiator`

    - #### handleResponse

          protected boolean handleResponse(INegotiationContext context,
                                           java.nio.ByteBuffer response)

      Overrides:
        `handleResponse` in class `ChallengeResponseNegotiator`

Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html