1
2
3
4 package org.itracker.services.authentication.adsson;
5
6 import java.io.IOException;
7
8 import javax.security.auth.login.LoginException;
9
10 import org.apache.log4j.Logger;
11 import org.itracker.model.User;
12 import org.itracker.services.exceptions.AuthenticatorException;
13
14
15
16
17
18
19
20 public class WindowsSSONAuthenticatorADInfo extends WindowsSSONAuthenticator {
21 private static final Logger logger = Logger.getLogger(WindowsSSONAuthenticatorADInfo.class);
22
23
24
25
26 protected User getExternalUserInfo(String login) throws AuthenticatorException {
27 try {
28
29 ADIntegration ad = new ADIntegration();
30 ad.login();
31
32 User userModel = (User)ad.getUserInfo( login );
33 return userModel;
34 } catch (LoginException e) {
35 logger.error("getExternalUserInfo: " + e.getMessage() + AuthenticatorException.SYSTEM_ERROR );
36 throw new AuthenticatorException( "Error accessing Active Directory: " + e.getMessage(), AuthenticatorException.SYSTEM_ERROR, e);
37 } catch (IOException e) {
38 logger.error( e.getMessage() );
39 throw new AuthenticatorException( e.getMessage(), AuthenticatorException.SYSTEM_ERROR);
40 }
41 }
42
43 }