]> err.no Git - sope/blob - sope-appserver/NGObjWeb/SoObjects/SoCookieAuthenticator.h
added some WebDrive WebDAV properties
[sope] / sope-appserver / NGObjWeb / SoObjects / SoCookieAuthenticator.h
1 /*
2   Copyright (C) 2006 Helge Hess
3
4   This file is part of SOPE.
5
6   SOPE is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #ifndef __SoObjects_SoCookieAuthenticator_H__
23 #define __SoObjects_SoCookieAuthenticator_H__
24
25 #import <Foundation/NSObject.h>
26
27 /*
28   SoCookieAuthenticator
29
30   SoCookieAuthenticator is an abstract base class for Cookie based
31   authentication. That is, it uses a Cookie to store the credentials
32   or a token of a session.
33   In the simplest case you only need to override -checkLogin:password:
34   to ensure login/password combinations.
35   
36   NOTE: work in progress.
37   
38   TODO: we also need a WOSessionAuthenticator which assumes that the
39         existance of a session implies a successful authentication?
40 */
41
42 @class NSString, NSException, NSArray;
43 @class WOContext, WOResponse, WOCookie;
44 @class SoUser;
45
46 @interface SoCookieAuthenticator : NSObject
47 {
48 }
49
50 /* password checker (override in subclasses !) */
51
52 - (BOOL)checkLogin:(NSString *)_login password:(NSString *)_pwd;
53
54 /* Cookie authentication */
55
56 - (NSString *)cookieNameInContext:(WOContext *)_ctx;
57 - (WOResponse *)preprocessCredentialsInContext:(WOContext *)_ctx;
58
59 - (NSString *)checkCredentialsInContext:(WOContext *)_ctx;
60 - (NSArray *)parseCredentials:(NSString *)_creds;
61
62 /* user management */
63
64 - (SoUser *)userInContext:(WOContext *)_ctx;
65 - (NSArray *)rolesForLogin:(NSString *)_login;
66
67 /* render auth exceptions of SoSecurityManager */
68
69 - (BOOL)renderException:(NSException *)_e inContext:(WOContext *)_ctx;
70
71 @end
72
73 #endif /* __SoObjects_SoCookieAuthenticator_H__ */