forked from rainliu/sip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProxyAuthorizationParser.go
41 lines (36 loc) · 1.08 KB
/
ProxyAuthorizationParser.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package parser
import (
"github.com/tutuvss/sip/core"
"github.com/tutuvss/sip/header"
)
/** SIPParser for ProxyAuthorization headers.
*/
type ProxyAuthorizationParser struct {
ChallengeParser
}
/** Constructor
* @param proxyAuthorization -- header to parse
*/
func NewProxyAuthorizationParser(proxyAuthorization string) *ProxyAuthorizationParser {
this := &ProxyAuthorizationParser{}
this.ChallengeParser.super(proxyAuthorization)
return this
}
/** Cosntructor
* @param lexer to set
*/
func NewProxyAuthorizationParserFromLexer(lexer core.Lexer) *ProxyAuthorizationParser {
this := &ProxyAuthorizationParser{}
this.ChallengeParser.superFromLexer(lexer)
return this
}
/** parse the String message
* @return SIPHeader (ProxyAuthenticate object)
* @throws ParseException if the message does not respect the spec.
*/
func (this *ProxyAuthorizationParser) Parse() (sh header.Header, ParseException error) {
this.HeaderName(TokenTypes_PROXY_AUTHORIZATION)
proxyAuth := header.NewProxyAuthorization()
ParseException = this.ChallengeParser.Parse(proxyAuth)
return proxyAuth, ParseException
}