View Javadoc

1   /*
2    *  Copyright 2004-2006 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 org.asteriskjava.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 org.asteriskjava.manager.action.LoginAction
25   * @see org.asteriskjava.manager.response.ChallengeResponse
26   * @author srt
27   * @version $Id: ChallengeAction.java 729 2007-05-26 05:16:57Z sprior $
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      @Override
61     public String getAction()
62      {
63          return "Challenge";
64      }
65  
66      /***
67       * Returns the digest alogrithm to use.
68       */
69      public String getAuthType()
70      {
71          return authType;
72      }
73  
74      /***
75       * Sets the digest alogrithm to use. Currently asterisk only supports "MD5".
76       */
77      public void setAuthType(String authType)
78      {
79          this.authType = authType;
80      }
81  }