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*/ 26package gov.nist.javax.sip.parser; 27 28import gov.nist.javax.sip.header.*; 29import gov.nist.core.*; 30import java.text.ParseException; 31 32/** 33 * Parser for Authentication-Info header. 34 * 35 * @version 1.2 $Revision: 1.9 $ $Date: 2009/07/17 18:57:57 $ 36 * 37 * @author Olivier Deruelle 38 * @author M. Ranganathan 39 * 40 */ 41public class AuthenticationInfoParser extends ParametersParser { 42 43 /** 44 * Creates a new instance of AuthenticationInfoParser 45 * @param authenticationInfo the header to parse 46 */ 47 public AuthenticationInfoParser(String authenticationInfo) { 48 super(authenticationInfo); 49 } 50 51 /** 52 * Constructor 53 * @param lexer the lexer to use to parse the header 54 */ 55 protected AuthenticationInfoParser(Lexer lexer) { 56 super(lexer); 57 } 58 59 /** 60 * parse the AuthenticationInfo String header 61 * @return SIPHeader (AuthenticationInfoList object) 62 * @throws SIPParseException if the message does not respect the spec. 63 */ 64 public SIPHeader parse() throws ParseException { 65 66 if (debug) 67 dbg_enter("AuthenticationInfoParser.parse"); 68 69 try { 70 headerName(TokenTypes.AUTHENTICATION_INFO); 71 72 AuthenticationInfo authenticationInfo = new AuthenticationInfo(); 73 authenticationInfo.setHeaderName( 74 SIPHeaderNames.AUTHENTICATION_INFO); 75 76 this.lexer.SPorHT(); 77 78 NameValue nv = super.nameValue(); 79 authenticationInfo.setParameter(nv); 80 this.lexer.SPorHT(); 81 while (lexer.lookAhead(0) == ',') { 82 this.lexer.match(','); 83 this.lexer.SPorHT(); 84 85 nv = super.nameValue(); 86 authenticationInfo.setParameter(nv); 87 this.lexer.SPorHT(); 88 } 89 this.lexer.SPorHT(); 90 //this.lexer.match('\n'); 91 92 return authenticationInfo; 93 } finally { 94 if (debug) 95 dbg_leave("AuthenticationInfoParser.parse"); 96 } 97 } 98 99 /* 100 101 **/ 102} 103/* 104 * $Log: AuthenticationInfoParser.java,v $ 105 * Revision 1.9 2009/07/17 18:57:57 emcho 106 * Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project. 107 * 108 * Revision 1.8 2006/07/13 09:02:06 mranga 109 * Issue number: 110 * Obtained from: 111 * Submitted by: jeroen van bemmel 112 * Reviewed by: mranga 113 * Moved some changes from jain-sip-1.2 to java.net 114 * 115 * CVS: ---------------------------------------------------------------------- 116 * CVS: Issue number: 117 * CVS: If this change addresses one or more issues, 118 * CVS: then enter the issue number(s) here. 119 * CVS: Obtained from: 120 * CVS: If this change has been taken from another system, 121 * CVS: then name the system in this line, otherwise delete it. 122 * CVS: Submitted by: 123 * CVS: If this code has been contributed to the project by someone else; i.e., 124 * CVS: they sent us a patch or a set of diffs, then include their name/email 125 * CVS: address here. If this is your work then delete this line. 126 * CVS: Reviewed by: 127 * CVS: If we are doing pre-commit code reviews and someone else has 128 * CVS: reviewed your changes, include their name(s) here. 129 * CVS: If you have not had it reviewed then delete this line. 130 * 131 * Revision 1.3 2006/06/19 06:47:27 mranga 132 * javadoc fixups 133 * 134 * Revision 1.2 2006/06/16 15:26:28 mranga 135 * Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak 136 * 137 * Revision 1.1.1.1 2005/10/04 17:12:35 mranga 138 * 139 * Import 140 * 141 * 142 * Revision 1.6 2004/07/28 14:13:54 mranga 143 * Submitted by: mranga 144 * 145 * Move out the test code to a separate test/unit class. 146 * Fixed some encode methods. 147 * 148 * Revision 1.5 2004/01/22 13:26:31 sverker 149 * Issue number: 150 * Obtained from: 151 * Submitted by: sverker 152 * Reviewed by: mranga 153 * 154 * Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags. 155 * 156 * CVS: ---------------------------------------------------------------------- 157 * CVS: Issue number: 158 * CVS: If this change addresses one or more issues, 159 * CVS: then enter the issue number(s) here. 160 * CVS: Obtained from: 161 * CVS: If this change has been taken from another system, 162 * CVS: then name the system in this line, otherwise delete it. 163 * CVS: Submitted by: 164 * CVS: If this code has been contributed to the project by someone else; i.e., 165 * CVS: they sent us a patch or a set of diffs, then include their name/email 166 * CVS: address here. If this is your work then delete this line. 167 * CVS: Reviewed by: 168 * CVS: If we are doing pre-commit code reviews and someone else has 169 * CVS: reviewed your changes, include their name(s) here. 170 * CVS: If you have not had it reviewed then delete this line. 171 * 172 */ 173