View Javadoc

1   /*
2   Copyright (C) 2000 - 2007 Grid Systems, S.A.
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, version 2, as
6   published by the Free Software Foundation.
7   
8   This program is distributed in the hope that it will be useful,
9   but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  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, write to the Free Software
15  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  */
17  
18  package com.gridsystems.innergrid.api;
19  
20  import javax.xml.rpc.Stub;
21  
22  /**
23   * Implementation of the credentials for UsernameToken authentication.
24   *
25   * @author Rodrigo Ruiz
26   * @version 1.0
27   */
28  public class UsernameTokenCredentials implements Credentials {
29  
30    /**
31     * The user name.
32     */
33    private String userName;
34  
35    /**
36     * The user password.
37     */
38    private String password;
39  
40    /**
41     * Creates a new instance with the specified name and password.
42     *
43     * @param userName a string with the user name
44     * @param password a string with the user password
45     */
46    public UsernameTokenCredentials(String userName, String password) {
47      this.userName = userName;
48      this.password = password;
49    }
50  
51    /**
52     * {@inheritDoc}
53     */
54    public String getUserName() {
55      return this.userName;
56    }
57  
58    /**
59     * {@inheritDoc}
60     */
61    public void setup(Stub stub) {
62      stub._setProperty(Stub.USERNAME_PROPERTY, this.userName);
63      stub._setProperty(Stub.PASSWORD_PROPERTY, this.password);
64    }
65  }