KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > framework > security > Officer


1 /**
2  * Copyright (C) 2003-2005 Funambol
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19
20 package sync4j.framework.security;
21
22 import java.security.Principal JavaDoc;
23
24 import sync4j.framework.core.Cred;
25
26 /**
27  * This the interface that defines how credentials are authenticated to a device
28  * and how resources are authorized for a given credential.
29  *
30  * @author Stefano Fornari @ Funambol.com
31  * @version $Id: Officer.java,v 1.12 2005/03/02 20:57:38 harrie Exp $
32  */

33 public interface Officer {
34     
35     /**
36      * Authenticates a credential.
37      *
38      * @param credential the credential to be authenticated
39      *
40      * @return true if the credential is autenticated, false otherwise
41      */

42     public boolean authenticate(Cred credential);
43     
44     /**
45      * Un-authenticates a credential.
46      *
47      * @param credential the credential to be unauthenticated
48      */

49     public void unAuthenticate(Cred credential);
50     
51     /**
52      * Authorizes a resource.
53      *
54      * @param credential the requesting entity
55      * @param resource the name (or the identifier) of the resource to be authorized
56      *
57      * @return true if the credential is authorized to access the resource, false
58      * otherwise
59      */

60     public boolean authorize(Principal JavaDoc credential, String JavaDoc resource);
61
62     /**
63      * Is the account authenticated by this officer expired?
64      *
65      * @return true if the account is expired, false otherwise
66      */

67     public boolean isAccountExpired();
68     
69     /**
70      * Read property client_auth
71      *
72      * @return the authentication's type the server requires to client
73      * to authenticate it
74      */

75     public String JavaDoc getClientAuth();
76     
77     /**
78      * Read property server_auth
79      *
80      * @return the authentication's type the client requires to server to
81      * authenticate it
82      */

83     public String JavaDoc getServerAuth();
84 }
85
86
Popular Tags