2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FWebCtrlAuthenticationChallenge.cpp
20 * @brief The file contains the definition of AuthenticationChallenge class.
22 * The file contains the definition of AuthenticationChallenge class.
24 #include <FBaseResult.h>
25 #include <FBaseSysLog.h>
26 #include <FWebCtrlAuthenticationChallenge.h>
27 #include <FSec_AccessController.h>
28 #include "FWebCtrl_AuthenticationChallengeImpl.h"
31 using namespace Tizen::Base;
32 using namespace Tizen::Security;
35 namespace Tizen { namespace Web { namespace Controls
39 AuthenticationChallenge::AuthenticationChallenge(void)
40 : __pAuthenticationChallengeImpl(new (std::nothrow) _AuthenticationChallengeImpl())
42 SysTryReturnVoidResult(NID_WEB_CTRL, __pAuthenticationChallengeImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
46 AuthenticationChallenge::~AuthenticationChallenge(void)
48 delete __pAuthenticationChallengeImpl;
49 __pAuthenticationChallengeImpl = null;
54 AuthenticationChallenge::Process(const UserId& userId, const String& password)
56 SysAssertf(__pAuthenticationChallengeImpl != null, "Not yet constructed. Construct() should be called before use.");
61 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
62 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
63 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
65 __pAuthenticationChallengeImpl->Process(userId, password);
67 SysSecureLog(NID_WEB_CTRL, "The current value of userId is %ls, password is %ls", userId.GetPointer(), password.GetPointer());
72 AuthenticationChallenge::Cancel(void)
74 SysAssertf(__pAuthenticationChallengeImpl != null, "Not yet constructed. Construct() should be called before use.");
79 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
80 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
81 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
83 __pAuthenticationChallengeImpl->Cancel();
87 }}} // Tizen::Web::Controls