Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 841931 of NPN_GetAuthenticationInfo

  • Revision slug: Mozilla/Add-ons/Plugins/Reference/NPN_GetAuthenticationInfo
  • Revision title: NPN_GetAuthenticationInfo
  • Revision id: 841931
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment 179 words added, 31 words removedNPN_GetAuthenticationInfo Mozilla/Add-ons/Plugins/Reference/NPN_GetAuthenticationInfo

Revision Content

{{ Np-browser-api() }}

Summary

The function is called by plugins to get HTTP authentication information from the browser.

Syntax

#include <npapi.h>

NPError NPN_GetAuthenticationInfo(NPP instance,
                                  const char *protocol,
                                  const char *host,
                                  int32_t port,
                                  const char *scheme,
                                  const char *realm,
                                  char **username,
                                  uint32_t *ulen,
                                  char **password,
                                  uint32_t *plen);

Parameters

This function has the following parameters:

instance
Pointer to the current plug-in instance
protocol
Protocol name (URI scheme)
host
Host name
port
Port number
scheme
HTTP authentication scheme name
realm
HTTP authentication realm
username
Out parameter. The browser passes back the HTTP username. If the function succeeds, the result buffer will be allocated with NPN_MemAlloc; the plugin is responsible for freeing the buffer. Note: the username may have internal NULL bytes and may not be NULL-terminated.
ulen
Out parameter. The length of the returned username buffer.
password
Out parameter. The browser passes back the HTTP password. If the function succeed, the result buffer will be allocated with NPN_MemAlloc; the plugin is responsible for freeing the buffer. Note: the password may have internal NULL bytes and may not be NULL-terminated.
plen
Out parameter. The length of the returned password buffer.

Returns

  • If successful, the function returns NPERR_NO_ERROR.
  • If unsuccessful, the function returns an error code. For possible values, see Error Codes.

Description

Plugin which implement their own HTTP networking stack (such as the Java plugin) may want to use the standard HTTP auth prompts and password managed of the browser. This function allows the plugin to ask the browser for HTTP authentication information for a domain.

Unless the plugin has special networking needs, it is recommended to use the standard network APIs, such as NPN_GetURLNotify/NPN_PostURLNotify.

See also

NPN_SetValueForURL, NPN_GetValueForURL

Revision Source

<p>{{ Np-browser-api() }}</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>The function is called by plugins to get HTTP authentication information from the browser.</p>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<pre>#include &lt;npapi.h&gt;

NPError NPN_GetAuthenticationInfo(NPP instance,
                                  const char *protocol,
                                  const char *host,
                                  int32_t port,
                                  const char *scheme,
                                  const char *realm,
                                  char **username,
                                  uint32_t *ulen,
                                  char **password,
                                  uint32_t *plen);

</pre>
<h3 id="Parameters" name="Parameters">Parameters</h3>
<p>This function has the following parameters:</p>
<dl> <dt>instance</dt> <dd>Pointer to the current plug-in instance</dd>
</dl>
<dl> <dt>protocol</dt> <dd>Protocol name (URI scheme)</dd>
</dl>
<dl> <dt>host</dt> <dd>Host name</dd>
</dl>
<dl> <dt>port</dt> <dd>Port number</dd>
</dl>
<dl> <dt>scheme</dt> <dd>HTTP authentication scheme name</dd>
</dl>
<dl> <dt>realm</dt> <dd>HTTP authentication realm</dd>
</dl>
<dl> <dt>username</dt> <dd>Out parameter. The browser passes back the HTTP username. If the function succeeds, the result buffer will be allocated with NPN_MemAlloc; the plugin is responsible for freeing the buffer. <em>Note: the username may have internal NULL bytes and may not be NULL-terminated.</em></dd>
</dl>
<dl> <dt>ulen</dt> <dd>Out parameter. The length of the returned username buffer.</dd>
</dl>
<dl> <dt>password</dt> <dd>Out parameter. The browser passes back the HTTP password. If the function succeed, the result buffer will be allocated with NPN_MemAlloc; the plugin is responsible for freeing the buffer. <em>Note: the password may have internal NULL bytes and may not be NULL-terminated.</em></dd>
</dl>
<dl> <dt>plen</dt> <dd>Out parameter. The length of the returned password buffer.</dd>
</dl>
<h3 id="Returns" name="Returns">Returns</h3>
<ul> <li>If successful, the function returns NPERR_NO_ERROR.</li> <li>If unsuccessful, the function returns an error code. For possible values, see <a href="/en/NPAPI/Constants#Error_Codes" title="en/NPAPI/Constants#Error_Codes">Error Codes</a>.</li>
</ul>
<h3 id="Description" name="Description">Description</h3>
<p>Plugin which implement their own HTTP networking stack (such as the Java plugin) may want to use the standard HTTP auth prompts and password managed of the browser. This function allows the plugin to ask the browser for HTTP authentication information for a domain.</p>
<p>Unless the plugin has special networking needs, it is recommended to use the <a href="/en/Gecko_Plugin_API_Reference/Streams" title="en/Gecko Plugin API Reference/Streams">standard network APIs</a>, such as <a href="/en/NPN_GetURLNotify" title="en/NPN GetURLNotify">NPN_GetURLNotify</a>/<a href="/en/NPN_PostURLNotify" title="en/NPN PostURLNotify">NPN_PostURLNotify</a>.</p>
<p>See also</p>
<p><a href="/en/NPN_SetValueForURL" title="en/NPN_SetValueForURL">NPN_SetValueForURL</a>, <a href="/en/NPN_GetValueForURL" title="en/NPN_GetValueForURL">NPN_GetValueForURL</a></p>
Revert to this revision