source: josm/trunk/src/org/openstreetmap/josm/io/auth/CredentialsAgentResponse.java@ 6986

Last change on this file since 6986 was 6222, checked in by Don-vip, 11 years ago

Make some more defensive copies of user-supplied arrays, javadoc

  • Property svn:eol-style set to native
File size: 2.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.io.auth;
3
4import org.openstreetmap.josm.tools.Utils;
5
6/**
7 * CredentialsAgentResponse represents the response from {@link CredentialsAgent#getCredentials(java.net.Authenticator.RequestorType, String, boolean)}.
8 *
9 * The response consists of the username and the password the requested credentials consists of.
10 * In addition, it provides information whether authentication was canceled by the user, i.e.
11 * because he or she canceled a username/password dialog (see {@link #isCanceled()}.
12 * It also provides information whether authentication should be saved.
13 *
14 */
15public class CredentialsAgentResponse {
16 private String username;
17 private char[] password;
18 private boolean canceled;
19 private boolean saveCredentials;
20 /**
21 * Replies the user name
22 * @return The user name
23 */
24 public String getUsername() {
25 return username;
26 }
27 /**
28 * Sets the user name
29 * @param username The user name
30 */
31 public void setUsername(String username) {
32 this.username = username;
33 }
34 /**
35 * Replies the password
36 * @return The password in plain text
37 */
38 public char[] getPassword() {
39 return password;
40 }
41 /**
42 * Sets the password
43 * @param password The password in plain text
44 */
45 public void setPassword(char[] password) {
46 this.password = Utils.copyArray(password);
47 }
48 /**
49 * Determines if authentication request has been canceled by user
50 * @return true if authentication request has been canceled by user, false otherwise
51 */
52 public boolean isCanceled() {
53 return canceled;
54 }
55 /**
56 * Sets the cancelation status (authentication request canceled by user)
57 * @param canceled the cancelation status (authentication request canceled by user)
58 */
59 public void setCanceled(boolean canceled) {
60 this.canceled = canceled;
61 }
62 /**
63 * Determines if authentication credentials should be saved
64 * @return true if authentication credentials should be saved, false otherwise
65 */
66 public boolean isSaveCredentials() {
67 return saveCredentials;
68 }
69 /**
70 * Sets the saving status (authentication credentials to save)
71 * @param saveCredentials the saving status (authentication credentials to save)
72 */
73 public void setSaveCredentials(boolean saveCredentials) {
74 this.saveCredentials = saveCredentials;
75 }
76}
Note: See TracBrowser for help on using the repository browser.