nsIAuthInformation.idl (4036B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #include "nsISupports.idl" 6 7 /** 8 * A object that hold authentication information. The caller of 9 * nsIAuthPrompt2::promptUsernameAndPassword or 10 * nsIAuthPrompt2::promptPasswordAsync provides an object implementing this 11 * interface; the prompt implementation can then read the values here to prefill 12 * the dialog. After the user entered the authentication information, it should 13 * set the attributes of this object to indicate to the caller what was entered 14 * by the user. 15 */ 16 [scriptable, uuid(0d73639c-2a92-4518-9f92-28f71fea5f20)] 17 interface nsIAuthInformation : nsISupports 18 { 19 /** @name Flags */ 20 /* @{ */ 21 /** 22 * This dialog belongs to a network host. 23 */ 24 const uint32_t AUTH_HOST = 1; 25 26 /** 27 * This dialog belongs to a proxy. 28 */ 29 const uint32_t AUTH_PROXY = 2; 30 31 /** 32 * This dialog needs domain information. The user interface should show a 33 * domain field, prefilled with the domain attribute's value. 34 */ 35 const uint32_t NEED_DOMAIN = 4; 36 37 /** 38 * This dialog only asks for password information. Authentication prompts 39 * SHOULD NOT show a username field. Attempts to change the username field 40 * will have no effect. nsIAuthPrompt2 implementations should, however, show 41 * its initial value to the user in some form. For example, a paragraph in 42 * the dialog might say "Please enter your password for user jsmith at 43 * server intranet". 44 * 45 * This flag is mutually exclusive with #NEED_DOMAIN. 46 */ 47 const uint32_t ONLY_PASSWORD = 8; 48 49 /** 50 * We have already tried to log in for this channel 51 * (with auth values from a previous promptAuth call), 52 * but it failed, so we now ask the user to provide a new, correct login. 53 * 54 * @see also RFC 2616, Section 10.4.2 55 */ 56 const uint32_t PREVIOUS_FAILED = 16; 57 58 /** 59 * A cross-origin sub-resource requests an authentication. 60 * The message presented to users must reflect that. 61 */ 62 const uint32_t CROSS_ORIGIN_SUB_RESOURCE = 32; 63 /* @} */ 64 65 /** 66 * Flags describing this dialog. A bitwise OR of the flag values 67 * above. 68 * 69 * It is possible that neither #AUTH_HOST nor #AUTH_PROXY are set. 70 * 71 * Auth prompts should ignore flags they don't understand; especially, they 72 * should not throw an exception because of an unsupported flag. 73 */ 74 readonly attribute unsigned long flags; 75 76 /** 77 * The server-supplied realm of the authentication as defined in RFC 2617. 78 * Can be the empty string if the protocol does not support realms. 79 * Otherwise, this is a human-readable string like "Secret files". 80 */ 81 readonly attribute AString realm; 82 83 /** 84 * The authentication scheme used for this request, if applicable. If the 85 * protocol for this authentication does not support schemes, this will be 86 * the empty string. Otherwise, this will be a string such as "basic" or 87 * "digest". This string will always be in lowercase. 88 */ 89 readonly attribute AUTF8String authenticationScheme; 90 91 /** 92 * The initial value should be used to prefill the dialog or be shown 93 * in some other way to the user. 94 * On return, this parameter should contain the username entered by 95 * the user. 96 * This field can only be changed if the #ONLY_PASSWORD flag is not set. 97 */ 98 attribute AString username; 99 100 /** 101 * The initial value should be used to prefill the dialog or be shown 102 * in some other way to the user. 103 * The password should not be shown in clear. 104 * On return, this parameter should contain the password entered by 105 * the user. 106 */ 107 attribute AString password; 108 109 /** 110 * The initial value should be used to prefill the dialog or be shown 111 * in some other way to the user. 112 * On return, this parameter should contain the domain entered by 113 * the user. 114 * This attribute is only used if flags include #NEED_DOMAIN. 115 */ 116 attribute AString domain; 117 };