01: /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
02: *
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * Unless required by applicable law or agreed to in writing, software
10: * distributed under the License is distributed on an "AS IS" BASIS,
11: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: * See the License for the specific language governing permissions and
13: * limitations under the License.
14: */
15:
16: package org.acegisecurity.providers.x509;
17:
18: import org.acegisecurity.AuthenticationException;
19:
20: import org.acegisecurity.userdetails.UserDetails;
21:
22: import java.security.cert.X509Certificate;
23:
24: /**
25: * Populates the <code>UserDetails</code> associated with the X.509
26: * certificate presented by a client.
27: * <p>
28: * Although the certificate will already have been validated by the web container,
29: * implementations may choose to perform additional application-specific checks on
30: * the certificate content here. If an implementation chooses to reject the certificate,
31: * it should throw a {@link org.acegisecurity.BadCredentialsException}.
32: * </p>
33: *
34: * @author Luke Taylor
35: * @version $Id: X509AuthoritiesPopulator.java 1496 2006-05-23 13:38:33Z benalex $
36: */
37: public interface X509AuthoritiesPopulator {
38: //~ Methods ========================================================================================================
39:
40: /**
41: * Obtains the granted authorities for the specified user.<p>May throw any
42: * <code>AuthenticationException</code> or return <code>null</code> if the authorities are unavailable.</p>
43: *
44: * @param userCertificate the X.509 certificate supplied
45: *
46: * @return the details of the indicated user (at minimum the granted authorities and the username)
47: *
48: * @throws AuthenticationException if the user details are not available or the certificate isn't valid for the
49: * application's purpose.
50: */
51: UserDetails getUserDetails(X509Certificate userCertificate)
52: throws AuthenticationException;
53: }
|