1 /* 2 * Conditions Of Use 3 * 4 * This software was developed by employees of the National Institute of 5 * Standards and Technology (NIST), an agency of the Federal Government. 6 * Pursuant to title 15 Untied States Code Section 105, works of NIST 7 * employees are not subject to copyright protection in the United States 8 * and are considered to be in the public domain. As a result, a formal 9 * license is not needed to use the software. 10 * 11 * This software is provided by NIST as a service and is expressly 12 * provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED 13 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF 14 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT 15 * AND DATA ACCURACY. NIST does not warrant or make any representations 16 * regarding the use of the software or the results thereof, including but 17 * not limited to the correctness, accuracy, reliability or usefulness of 18 * the software. 19 * 20 * Permission to use this software is contingent upon your acceptance 21 * of the terms of this agreement 22 * 23 * . 24 * 25 */ 26 package gov.nist.javax.sip.parser; 27 28 import gov.nist.javax.sip.header.*; 29 import java.text.ParseException; 30 31 /** 32 * Parser for ProxyAuthenticate headers. 33 * 34 * @version 1.2 $Revision: 1.7 $ $Date: 2009/07/17 18:58:02 $ 35 * 36 * @author M. Ranganathan <br/> 37 * 38 * 39 */ 40 public class ProxyAuthenticateParser extends ChallengeParser { 41 42 /** 43 * Constructor 44 * @param proxyAuthenticate message to parse 45 */ 46 public ProxyAuthenticateParser(String proxyAuthenticate) { 47 super(proxyAuthenticate); 48 } 49 50 /** 51 * Cosntructor 52 * @param Lexer lexer to set 53 */ 54 protected ProxyAuthenticateParser(Lexer lexer) { 55 super(lexer); 56 } 57 58 /** 59 * parse the String message 60 * @return SIPHeader (ProxyAuthenticate object) 61 * @throws ParseException if the message does not respect the spec. 62 */ 63 public SIPHeader parse() throws ParseException { 64 headerName(TokenTypes.PROXY_AUTHENTICATE); 65 ProxyAuthenticate proxyAuthenticate = new ProxyAuthenticate(); 66 super.parse(proxyAuthenticate); 67 return proxyAuthenticate; 68 } 69 70 /** Test program 71 public static void main(String args[]) throws ParseException { 72 String paAuth[] = { 73 "Proxy-Authenticate: Digest realm=\"MCI WorldCom SIP\","+ 74 "domain=\"sip:ss2.wcom.com\", nonce=\"ea9c8e88df84f1cec4341ae6cbe5a359\","+ 75 "opaque=\"\", stale=FALSE, algorithm=MD5\n", 76 77 "Proxy-Authenticate: Digest realm=\"MCI WorldCom SIP\","+ 78 "qop=\"auth\" , nonce-value=\"oli\"\n" 79 }; 80 81 for (int i = 0; i < paAuth.length; i++ ) { 82 ProxyAuthenticateParser pap = 83 new ProxyAuthenticateParser(paAuth[i]); 84 ProxyAuthenticate pa= (ProxyAuthenticate) pap.parse(); 85 System.out.println("encoded = " + pa.encode()); 86 } 87 88 } 89 */ 90 } 91 /* 92 * $Log: ProxyAuthenticateParser.java,v $ 93 * Revision 1.7 2009/07/17 18:58:02 emcho 94 * Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project. 95 * 96 * Revision 1.6 2006/07/13 09:02:17 mranga 97 * Issue number: 98 * Obtained from: 99 * Submitted by: jeroen van bemmel 100 * Reviewed by: mranga 101 * Moved some changes from jain-sip-1.2 to java.net 102 * 103 * CVS: ---------------------------------------------------------------------- 104 * CVS: Issue number: 105 * CVS: If this change addresses one or more issues, 106 * CVS: then enter the issue number(s) here. 107 * CVS: Obtained from: 108 * CVS: If this change has been taken from another system, 109 * CVS: then name the system in this line, otherwise delete it. 110 * CVS: Submitted by: 111 * CVS: If this code has been contributed to the project by someone else; i.e., 112 * CVS: they sent us a patch or a set of diffs, then include their name/email 113 * CVS: address here. If this is your work then delete this line. 114 * CVS: Reviewed by: 115 * CVS: If we are doing pre-commit code reviews and someone else has 116 * CVS: reviewed your changes, include their name(s) here. 117 * CVS: If you have not had it reviewed then delete this line. 118 * 119 * Revision 1.3 2006/06/19 06:47:27 mranga 120 * javadoc fixups 121 * 122 * Revision 1.2 2006/06/16 15:26:28 mranga 123 * Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak 124 * 125 * Revision 1.1.1.1 2005/10/04 17:12:35 mranga 126 * 127 * Import 128 * 129 * 130 * Revision 1.4 2004/01/22 13:26:31 sverker 131 * Issue number: 132 * Obtained from: 133 * Submitted by: sverker 134 * Reviewed by: mranga 135 * 136 * Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags. 137 * 138 * CVS: ---------------------------------------------------------------------- 139 * CVS: Issue number: 140 * CVS: If this change addresses one or more issues, 141 * CVS: then enter the issue number(s) here. 142 * CVS: Obtained from: 143 * CVS: If this change has been taken from another system, 144 * CVS: then name the system in this line, otherwise delete it. 145 * CVS: Submitted by: 146 * CVS: If this code has been contributed to the project by someone else; i.e., 147 * CVS: they sent us a patch or a set of diffs, then include their name/email 148 * CVS: address here. If this is your work then delete this line. 149 * CVS: Reviewed by: 150 * CVS: If we are doing pre-commit code reviews and someone else has 151 * CVS: reviewed your changes, include their name(s) here. 152 * CVS: If you have not had it reviewed then delete this line. 153 * 154 */ 155