xref: /haiku/src/apps/haikudepot/server/UserDetailVerifierProcess.h (revision 10cd325cfafb80353704ef021205ff5e5523d3a3)
1*10cd325cSAndrew Lindesay /*
2*10cd325cSAndrew Lindesay  * Copyright 2020, Andrew Lindesay <apl@lindesay.co.nz>.
3*10cd325cSAndrew Lindesay  * All rights reserved. Distributed under the terms of the MIT License.
4*10cd325cSAndrew Lindesay  */
5*10cd325cSAndrew Lindesay 
6*10cd325cSAndrew Lindesay #ifndef USER_DETAIL_VERIFIER_PROCESS_H
7*10cd325cSAndrew Lindesay #define USER_DETAIL_VERIFIER_PROCESS_H
8*10cd325cSAndrew Lindesay 
9*10cd325cSAndrew Lindesay #include <String.h>
10*10cd325cSAndrew Lindesay 
11*10cd325cSAndrew Lindesay #include "AbstractProcess.h"
12*10cd325cSAndrew Lindesay #include "Model.h"
13*10cd325cSAndrew Lindesay 
14*10cd325cSAndrew Lindesay 
15*10cd325cSAndrew Lindesay class UserDetailVerifierListener {
16*10cd325cSAndrew Lindesay public:
17*10cd325cSAndrew Lindesay 	virtual	void				UserUsageConditionsNotLatest(
18*10cd325cSAndrew Lindesay 									const UserDetail& userDetail) = 0;
19*10cd325cSAndrew Lindesay 	virtual	void				UserCredentialsFailed() = 0;
20*10cd325cSAndrew Lindesay };
21*10cd325cSAndrew Lindesay 
22*10cd325cSAndrew Lindesay 
23*10cd325cSAndrew Lindesay /*!	This service has the purpose of querying the application server (HDS)
24*10cd325cSAndrew Lindesay 	for details of the authenticated user.  This will check that the user
25*10cd325cSAndrew Lindesay 	has the correct username / password and also that the user has agreed
26*10cd325cSAndrew Lindesay 	to the current terms and conditions.
27*10cd325cSAndrew Lindesay  */
28*10cd325cSAndrew Lindesay 
29*10cd325cSAndrew Lindesay class UserDetailVerifierProcess : public AbstractProcess {
30*10cd325cSAndrew Lindesay public:
31*10cd325cSAndrew Lindesay 								UserDetailVerifierProcess(
32*10cd325cSAndrew Lindesay 									Model* model,
33*10cd325cSAndrew Lindesay 									UserDetailVerifierListener* listener);
34*10cd325cSAndrew Lindesay 	virtual						~UserDetailVerifierProcess();
35*10cd325cSAndrew Lindesay 
36*10cd325cSAndrew Lindesay 	virtual	const char*			Name() const;
37*10cd325cSAndrew Lindesay 	virtual	const char*			Description() const;
38*10cd325cSAndrew Lindesay 
39*10cd325cSAndrew Lindesay protected:
40*10cd325cSAndrew Lindesay 	virtual	status_t			RunInternal();
41*10cd325cSAndrew Lindesay 
42*10cd325cSAndrew Lindesay private:
43*10cd325cSAndrew Lindesay 			status_t			_TryFetchUserDetail(UserDetail& userDetail);
44*10cd325cSAndrew Lindesay 			bool				_ShouldVerify();
45*10cd325cSAndrew Lindesay 
46*10cd325cSAndrew Lindesay private:
47*10cd325cSAndrew Lindesay 			Model*				fModel;
48*10cd325cSAndrew Lindesay 			UserDetailVerifierListener*
49*10cd325cSAndrew Lindesay 								fListener;
50*10cd325cSAndrew Lindesay };
51*10cd325cSAndrew Lindesay 
52*10cd325cSAndrew Lindesay 
53*10cd325cSAndrew Lindesay #endif // USER_DETAIL_VERIFIER_PROCESS_H
54