netwerk/base/public/nsIAuthInformation.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/base/public/nsIAuthInformation.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,112 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsISupports.idl"
     1.9 +
    1.10 +/**
    1.11 + * A object that hold authentication information. The caller of
    1.12 + * nsIAuthPrompt2::promptUsernameAndPassword or
    1.13 + * nsIAuthPrompt2::promptPasswordAsync provides an object implementing this
    1.14 + * interface; the prompt implementation can then read the values here to prefill
    1.15 + * the dialog. After the user entered the authentication information, it should
    1.16 + * set the attributes of this object to indicate to the caller what was entered
    1.17 + * by the user.
    1.18 + */
    1.19 +[scriptable, uuid(0d73639c-2a92-4518-9f92-28f71fea5f20)]
    1.20 +interface nsIAuthInformation : nsISupports
    1.21 +{
    1.22 +  /** @name Flags */
    1.23 +  /* @{ */
    1.24 +  /**
    1.25 +   * This dialog belongs to a network host.
    1.26 +   */
    1.27 +  const uint32_t AUTH_HOST = 1;
    1.28 +
    1.29 +  /**
    1.30 +   * This dialog belongs to a proxy.
    1.31 +   */
    1.32 +  const uint32_t AUTH_PROXY = 2;
    1.33 +
    1.34 +  /**
    1.35 +   * This dialog needs domain information. The user interface should show a
    1.36 +   * domain field, prefilled with the domain attribute's value.
    1.37 +   */
    1.38 +  const uint32_t NEED_DOMAIN = 4;
    1.39 +
    1.40 +  /**
    1.41 +   * This dialog only asks for password information. Authentication prompts
    1.42 +   * SHOULD NOT show a username field. Attempts to change the username field
    1.43 +   * will have no effect. nsIAuthPrompt2 implementations should, however, show
    1.44 +   * its initial value to the user in some form. For example, a paragraph in
    1.45 +   * the dialog might say "Please enter your password for user jsmith at
    1.46 +   * server intranet".
    1.47 +   *
    1.48 +   * This flag is mutually exclusive with #NEED_DOMAIN.
    1.49 +   */
    1.50 +  const uint32_t ONLY_PASSWORD = 8;
    1.51 +
    1.52 +  /**
    1.53 +   * We have already tried to log in for this channel
    1.54 +   * (with auth values from a previous promptAuth call),
    1.55 +   * but it failed, so we now ask the user to provide a new, correct login.
    1.56 +   *
    1.57 +   * @see also RFC 2616, Section 10.4.2
    1.58 +   */
    1.59 +  const uint32_t PREVIOUS_FAILED = 16;
    1.60 +  /* @} */
    1.61 +
    1.62 +  /**
    1.63 +   * Flags describing this dialog. A bitwise OR of the flag values
    1.64 +   * above.
    1.65 +   *
    1.66 +   * It is possible that neither #AUTH_HOST nor #AUTH_PROXY are set.
    1.67 +   *
    1.68 +   * Auth prompts should ignore flags they don't understand; especially, they
    1.69 +   * should not throw an exception because of an unsupported flag.
    1.70 +   */
    1.71 +  readonly attribute unsigned long flags;
    1.72 +
    1.73 +  /**
    1.74 +   * The server-supplied realm of the authentication as defined in RFC 2617.
    1.75 +   * Can be the empty string if the protocol does not support realms.
    1.76 +   * Otherwise, this is a human-readable string like "Secret files".
    1.77 +   */
    1.78 +  readonly attribute AString realm;
    1.79 +
    1.80 +  /**
    1.81 +   * The authentication scheme used for this request, if applicable. If the
    1.82 +   * protocol for this authentication does not support schemes, this will be
    1.83 +   * the empty string. Otherwise, this will be a string such as "basic" or 
    1.84 +   * "digest". This string will always be in lowercase.
    1.85 +   */
    1.86 +  readonly attribute AUTF8String authenticationScheme;
    1.87 +
    1.88 +  /**
    1.89 +   * The initial value should be used to prefill the dialog or be shown
    1.90 +   * in some other way to the user.
    1.91 +   * On return, this parameter should contain the username entered by
    1.92 +   * the user.
    1.93 +   * This field can only be changed if the #ONLY_PASSWORD flag is not set.
    1.94 +   */
    1.95 +  attribute AString username;
    1.96 +
    1.97 +  /**
    1.98 +   * The initial value should be used to prefill the dialog or be shown
    1.99 +   * in some other way to the user.
   1.100 +   * The password should not be shown in clear.
   1.101 +   * On return, this parameter should contain the password entered by
   1.102 +   * the user.
   1.103 +   */
   1.104 +  attribute AString password;
   1.105 +
   1.106 +  /**
   1.107 +   * The initial value should be used to prefill the dialog or be shown
   1.108 +   * in some other way to the user.
   1.109 +   * On return, this parameter should contain the domain entered by
   1.110 +   * the user.
   1.111 +   * This attribute is only used if flags include #NEED_DOMAIN.
   1.112 +   */
   1.113 +  attribute AString domain;
   1.114 +};
   1.115 +

mercurial