1   /*
2    * Copyright 2003 - 2013 The eFaps Team
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   * Revision:        $Rev$
17   * Last Changed:    $Date$
18   * Last Changed By: $Author$
19   */
20  
21  package org.efaps.jaas;
22  
23  import javax.security.auth.callback.Callback;
24  
25  /**
26   * The class defines with which action the call back is made. It defines e.g.
27   * the difference between a login and an import of all persons.
28   *
29   * @author The eFaps Team
30   * @version $Id$
31   */
32  public class ActionCallback
33      implements Callback
34  {
35      /**
36       * Defines all possible modes of the call back.
37       */
38      public enum Mode {
39          /** A List of all persons is needed. */
40          ALL_PERSONS,
41          /** A 'normal' login is done. Name and Password must be checked. */
42          LOGIN,
43          /** Information about a person is needed. Password is not to check */
44          PERSON_INFORMATION,
45          /** The Password is set. The right to change the password must be checked */
46          SET_PASSWORD,
47          /** Mode is undefined. An exception should be thrown. */
48          UNDEFINED
49      }
50  
51      /**
52       * @see #setMode(Mode)
53       * @see #getMode()
54       */
55      private Mode mode = ActionCallback.Mode.UNDEFINED;
56  
57      /**
58       * This is the setter method for instance variable {@link #mode}.
59       *
60       * @param _mode new value for instance variable {@link #mode}
61       * @see #mode
62       * @see #getMode()
63       */
64      public void setMode(final Mode _mode)
65      {
66          this.mode = _mode;
67      }
68  
69      /**
70       * This is the getter method for instance variable {@link #mode}.
71       *
72       * @return the value of the instance variable {@link #mode}.
73       * @see #mode
74       * @see #setMode(Mode)
75       */
76      public Mode getMode()
77      {
78          return this.mode;
79      }
80  }