1
#ifndef USER_AUTH_GRABBER
2
#define USER_AUTH_GRABBER 1
4
#include "repro/Worker.hxx"
5
#include "repro/AbstractDb.hxx"
6
#include "repro/UserStore.hxx"
7
#include "resip/stack/Message.hxx"
8
#include "repro/UserInfoMessage.hxx"
9
#include "resip/dum/UserAuthInfo.hxx"
11
#define RESIPROCATE_SUBSYSTEM resip::Subsystem::REPRO
17
class UserAuthGrabber : public Worker
20
UserAuthGrabber(repro::UserStore& userStore ):
24
virtual ~UserAuthGrabber(){}
26
virtual bool process(resip::ApplicationMessage* msg)
28
repro::UserInfoMessage* uinf = dynamic_cast<UserInfoMessage*>(msg); // auth for repro's DigestAuthenticator
29
resip::UserAuthInfo* uainf = dynamic_cast<resip::UserAuthInfo*>(msg); // auth for DUM's ServerAuthManager
32
uinf->mRec.passwordHash = mUserStore.getUserAuthInfo(uinf->user(), uinf->realm());
33
DebugLog(<<"Grabbed user info for "
34
<< uinf->user() <<"@"<<uinf->realm()
35
<< " : " << uinf->A1());
40
uainf->setA1(mUserStore.getUserAuthInfo(uainf->getUser(), uainf->getRealm()));
41
if(uainf->getA1().empty())
43
uainf->setMode(resip::UserAuthInfo::UserUnknown);
45
DebugLog(<<"Grabbed user info for "
46
<< uainf->getUser() <<"@"<<uainf->getRealm()
47
<< " : " << uainf->getA1());
52
WarningLog(<<"Did not recognize message type...");
57
virtual UserAuthGrabber* clone() const
59
return new UserAuthGrabber(mUserStore);
63
UserStore& mUserStore;
69
/* ====================================================================
70
* The Vovida Software License, Version 1.0
72
* Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
74
* Redistribution and use in source and binary forms, with or without
75
* modification, are permitted provided that the following conditions
78
* 1. Redistributions of source code must retain the above copyright
79
* notice, this list of conditions and the following disclaimer.
81
* 2. Redistributions in binary form must reproduce the above copyright
82
* notice, this list of conditions and the following disclaimer in
83
* the documentation and/or other materials provided with the
86
* 3. The names "VOCAL", "Vovida Open Communication Application Library",
87
* and "Vovida Open Communication Application Library (VOCAL)" must
88
* not be used to endorse or promote products derived from this
89
* software without prior written permission. For written
90
* permission, please contact vocal@vovida.org.
92
* 4. Products derived from this software may not be called "VOCAL", nor
93
* may "VOCAL" appear in their name, without prior written
94
* permission of Vovida Networks, Inc.
96
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
97
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
98
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
99
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
100
* NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
101
* IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
102
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
103
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
104
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
105
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
106
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
107
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
110
* ====================================================================
112
* This software consists of voluntary contributions made by Vovida
113
* Networks, Inc. and many individuals on behalf of Vovida Networks,
114
* Inc. For more information on Vovida Networks, Inc., please see
115
* <http://www.vovida.org/>.