View Javadoc

1   /*
2    * Copyright  2004-2005 Stefan Reuter
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   */
17  package net.sf.asterisk.manager.action;
18  
19  /***
20   * The ChallengeAction requests a challenge from the server to use when logging
21   * in using challenge/response. Sending this action to the asterisk server
22   * results in a ChallengeResponse being received from the server.
23   * 
24   * @see net.sf.asterisk.manager.action.LoginAction
25   * @see net.sf.asterisk.manager.response.ChallengeResponse
26   * @author srt
27   * @version $Id: ChallengeAction.java,v 1.4 2005/08/07 00:09:42 srt Exp $
28   */
29  public class ChallengeAction extends AbstractManagerAction
30  {
31      /***
32       * Serializable version identifier
33       */
34      static final long serialVersionUID = 7240516124871953971L;
35      private String authType;
36  
37      /***
38       * Creates a new empty ChallengeAction.
39       */
40      public ChallengeAction()
41      {
42  
43      }
44  
45      /***
46       * Creates a new ChallengeAction that requests a new login challenge for use
47       * with the given digest algorithm.
48       * 
49       * @param authType the digest alogrithm to use.
50       * @since 0.2
51       */
52      public ChallengeAction(String authType)
53      {
54          this.authType = authType;
55      }
56  
57      /***
58       * Returns Returns the name of this action, i.e. "Challenge".
59       */
60      public String getAction()
61      {
62          return "Challenge";
63      }
64  
65      /***
66       * Returns the digest alogrithm to use.
67       */
68      public String getAuthType()
69      {
70          return authType;
71      }
72  
73      /***
74       * Sets the digest alogrithm to use. Currently asterisk only supports "MD5".
75       */
76      public void setAuthType(String authType)
77      {
78          this.authType = authType;
79      }
80  }