01: /*
02: * Copyright (C) 2005-2007 JasperSoft http://www.jaspersoft.com
03: *
04: * This program is free software; you can redistribute it and/or modify
05: * it under the terms of the GNU General Public License as published by
06: * the Free Software Foundation; either version 2 of the License, or
07: * (at your option) any later version.
08: *
09: * This program is distributed WITHOUT ANY WARRANTY; and without the
10: * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11: * See the GNU General Public License for more details.
12: *
13: * You should have received a copy of the GNU General Public License
14: * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
15: * or write to:
16: *
17: * Free Software Foundation, Inc.,
18: * 59 Temple Place - Suite 330,
19: * Boston, MA USA 02111-1307
20: *
21: *
22: * CustomHTTPAuthenticator.java
23: *
24: * Created on February 14, 2007, 4:36 PM
25: *
26: * To change this template, choose Tools | Template Manager
27: * and open the template in the editor.
28: */
29:
30: package it.businesslogic.ireport.data.olap;
31:
32: import java.net.Authenticator;
33: import java.net.InetAddress;
34: import java.net.PasswordAuthentication;
35:
36: /**
37: *
38: * @author gtoffoli
39: */
40: public class CustomHTTPAuthenticator extends Authenticator {
41:
42: private String username = "";
43: private String password = "";
44:
45: public CustomHTTPAuthenticator(String username, String password) {
46: this .username = username;
47: this .password = password;
48: }
49:
50: protected PasswordAuthentication getPasswordAuthentication() {
51: // Get information about the request
52: String promptString = getRequestingPrompt();
53: String hostname = getRequestingHost();
54: InetAddress ipaddr = getRequestingSite();
55: int port = getRequestingPort();
56: // Return the information
57: return new PasswordAuthentication(username, password
58: .toCharArray());
59: }
60:
61: public String getUsername() {
62: return username;
63: }
64:
65: public void setUsername(String username) {
66: this .username = username;
67: }
68:
69: public String getPassword() {
70: return password;
71: }
72:
73: public void setPassword(String password) {
74: this.password = password;
75: }
76:
77: }
|