/[resiprocate]/main/resip/dum/UserProfile.hxx
ViewVC logotype

Contents of /main/resip/dum/UserProfile.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9891 - (show annotations) (download)
Thu Oct 25 18:46:33 2012 UTC (7 years ago) by sgodin
File MIME type: text/plain
File size: 9716 byte(s)
 -added new UserProfile setting to DUM:  
  DigestCacheUseLimit is used to indicate the maximum number of times a particular 
  Proxy or WWW Authorization header will be used in requests within a dialogset.  
  When this limit is   reached then the next request in the DiaglogSet will go out 
  without digest credentials.  This setting can be used to work around bugs/limitations 
  in third-party implementations that have difficulty properly dealing with
  cached credentials.  A setting of 0 (default) will disable the limit and all requests 
  in a Dialogset will have the same cached Authorization header on them, until they are 
  re-challenged by the far end.  A setting of 1 disables caching entirely and future 
  requests within the dialog set will go out without any authorization headers.

Other Changes
 -resip ClientAuthManager - refactored dialogSetDestroyed and clearAuthenticationState to 
  be more logical
 -resip ClientPagerMessage - modified to allow onSuccess and onFailure callbacks even if queue
  of message contents is not used - allows you to call ClientPagerMessage::getMessageRequest,
  build the request yourself (even one without a body), send using DUM::send and still have 
  your callbacks invoked
1 #if !defined(RESIP_USERPROFILE_HXX)
2 #define RESIP_USERPROFILE_HXX
3
4 #include <iosfwd>
5 #include <set>
6 #include "resip/stack/Headers.hxx"
7 #include "resip/stack/MethodTypes.hxx"
8 #include "resip/stack/Tuple.hxx"
9 #include "resip/dum/Profile.hxx"
10
11 namespace resip
12 {
13
14 class Data;
15
16 class UserProfile : public Profile
17 {
18 public:
19 UserProfile();
20 UserProfile(SharedPtr<Profile> baseProfile);
21 virtual ~UserProfile();
22
23 virtual void setDefaultFrom(const NameAddr& from);
24 virtual NameAddr& getDefaultFrom();
25
26 virtual void setServiceRoute(const NameAddrs& sRoute);
27 virtual NameAddrs& getServiceRoute();
28
29 virtual void setImsAuthUser(const Data& userName, const Data& host) { mImsAuthUserName = userName; mImsAuthHost = host; }
30 virtual Data& getImsAuthUserName() { return mImsAuthUserName; }
31 virtual Data& getImsAuthHost() { return mImsAuthHost; }
32
33 // Returns a UserProfile that will return a UserProfile that can be used
34 // to send requests according to RFC 3323 and RFC 3325
35 virtual SharedPtr<UserProfile> getAnonymousUserProfile() const;
36 bool isAnonymous() const;
37
38 // !cj! - this GRUU stuff looks very suspect
39 // !dcm! -- yep, I don't think you can adda gruu..and disabling is weird.
40 //Anon should be on a per-call level...all of these will prob. go away.
41 //.dcm. anonymous gruu's will be used by making annon userprofile where
42 //one is avail. Up to the ap to keep the req'd reg up.
43 //1 gruu per userprofile for now.
44 virtual void addGruu(const Data& aor, const NameAddr& contact);
45 virtual bool hasGruu(const Data& aor) const;
46 virtual bool hasGruu(const Data& aor, const Data& instance) const;
47 virtual NameAddr& getGruu(const Data& aor);
48 virtual NameAddr& getGruu(const Data& aor, const NameAddr& contact);
49
50 //should do Supported wrangling--but what if required is desired? Same as 100rel?
51 virtual bool& gruuEnabled() { return mGruuEnabled; }
52 virtual bool gruuEnabled() const { return mGruuEnabled; }
53
54 virtual bool hasPublicGruu() const { return !mPubGruu.host().empty(); }
55 virtual const Uri& getPublicGruu() { return mPubGruu; }
56 virtual void setPublicGruu(const Uri& gruu) { mPubGruu = gruu; }
57
58 virtual bool hasTempGruu() const { return !mTempGruu.host().empty(); }
59 virtual const Uri& getTempGruu() { return mTempGruu; }
60 virtual void setTempGruu(const Uri& gruu) { mTempGruu = gruu; }
61
62 struct DigestCredential
63 {
64 DigestCredential();
65 DigestCredential(const Data& realm,
66 const Data& username,
67 const Data& pwd,
68 bool isPasswordA1Hash);
69 DigestCredential(const Data& realm);
70
71 Data realm;
72 Data user;
73 Data password;
74 bool isPasswordA1Hash;
75
76 bool operator<(const DigestCredential& rhs) const;
77 };
78
79 /// The following functions deal with clearing, setting and getting of digest credentals
80 virtual void clearDigestCredentials();
81 /// For the password you may either provide the plain text password (isPasswordA1Hash = false)
82 /// or the Digest A1 MD5 Hash (isPasswordA1Hash = true). Note: If the A1 hash is provided
83 /// then the realm MUST match the realm in the challenge or authentication will fail. If the
84 /// plain text password is provided, then we will form the A1 hash using the realm from
85 /// the challenge.
86 virtual void setDigestCredential( const Data& realm,
87 const Data& user,
88 const Data& password,
89 bool isPasswordA1Hash=false);
90 virtual const DigestCredential& getDigestCredential( const Data& realm );
91 // DigestCacheUseLimit is used to indicate the maximum number of times a particular Proxy or WWW Authorization
92 // header will be used in requests within a dialogset. When this limit is reached then the
93 // next request in the DiaglogSet will go out without digest credentials. This setting can be used to
94 // work around bugs/limitations in third-party implementations that have difficulty properly dealing with
95 // cached credentials. A setting of 0 (default) will disable the limit and all requests in a Dialogset will
96 // have the same cached Authorization header on them, until they are re-challenged by the far end. A setting of
97 // 1 disables caching entirely and future requests within the dialog set will go out without any authorization
98 // headers.
99 virtual void setDigestCacheUseLimit(unsigned long digestCacheUseLimit) { mDigestCacheUseLimit = digestCacheUseLimit; }
100 virtual unsigned long getDigestCacheUseLimit() { return mDigestCacheUseLimit; }
101
102 // Enable this to enable RFC5626 support in DUM - adds regId to registrations, and
103 // ;ob parameter to Path, Route, and Contact headers
104 // Warning: You MUST set an instanceId, a regId and an outbound proxy if you enable
105 // clientOutbound support. You MUST also ensure that you add the following Supported
106 // options:
107 // profile->addSupportedOptionTag(Token(Symbols::Outbound)); // RFC 5626 - outbound
108 // profile->addSupportedOptionTag(Token(Symbols::Path)); // RFC 3327 - path
109 virtual bool& clientOutboundEnabled() { return mClientOutboundEnabled; }
110 virtual bool clientOutboundEnabled() const { return mClientOutboundEnabled; }
111
112 // Outbound (RFC5626) instanceId used in contact headers
113 virtual bool hasInstanceId();
114 virtual void setInstanceId(const Data& id);
115 virtual const Data& getInstanceId() const;
116
117 // Outbound (RFC5626) regId used in registrations
118 virtual void setRegId(int regId) { mRegId = regId; }
119 virtual int getRegId() { return mRegId; }
120
121 // Returns the current Flow Tuple that is being used for communication on usages
122 // that use this profile
123 const Tuple& getClientOutboundFlowTuple() const { return mClientOutboundFlowTuple; }
124 void clearClientOutboundFlowTuple() { mClientOutboundFlowTuple = Tuple(); }
125
126 protected:
127 virtual UserProfile* clone() const;
128
129 private:
130 NameAddr mDefaultFrom;
131 Data mInstanceId;
132 NameAddrs mServiceRoute;
133 Data mImsAuthUserName;
134 Data mImsAuthHost;
135 bool mGruuEnabled;
136 Uri mPubGruu;
137 Uri mTempGruu;
138 const static NameAddr mAnonymous;
139
140 int mRegId;
141 bool mClientOutboundEnabled;
142 friend class DialogUsageManager; // Give DialogUsageManager, ClientRegistration, and Dialog access to mClientOutboundFlowKey
143 friend class ClientRegistration;
144 friend class Dialog;
145 Tuple mClientOutboundFlowTuple;
146
147 typedef std::set<DigestCredential> DigestCredentials;
148 DigestCredentials mDigestCredentials;
149 unsigned long mDigestCacheUseLimit;
150
151 friend EncodeStream& operator<<(EncodeStream&, const UserProfile& profile);
152 };
153
154 EncodeStream&
155 operator<<(EncodeStream&, const UserProfile& profile);
156
157 EncodeStream&
158 operator<<(EncodeStream&, const UserProfile::DigestCredential& cred);
159
160 }
161
162 #endif
163
164 /* ====================================================================
165 * The Vovida Software License, Version 1.0
166 *
167 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
168 *
169 * Redistribution and use in source and binary forms, with or without
170 * modification, are permitted provided that the following conditions
171 * are met:
172 *
173 * 1. Redistributions of source code must retain the above copyright
174 * notice, this list of conditions and the following disclaimer.
175 *
176 * 2. Redistributions in binary form must reproduce the above copyright
177 * notice, this list of conditions and the following disclaimer in
178 * the documentation and/or other materials provided with the
179 * distribution.
180 *
181 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
182 * and "Vovida Open Communication Application Library (VOCAL)" must
183 * not be used to endorse or promote products derived from this
184 * software without prior written permission. For written
185 * permission, please contact vocal@vovida.org.
186 *
187 * 4. Products derived from this software may not be called "VOCAL", nor
188 * may "VOCAL" appear in their name, without prior written
189 * permission of Vovida Networks, Inc.
190 *
191 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
192 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
193 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
194 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
195 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
196 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
197 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
198 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
199 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
200 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
201 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
202 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
203 * DAMAGE.
204 *
205 * ====================================================================
206 *
207 * This software consists of voluntary contributions made by Vovida
208 * Networks, Inc. and many individuals on behalf of Vovida Networks,
209 * Inc. For more information on Vovida Networks, Inc., please see
210 * <http://www.vovida.org/>.
211 *
212 */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27