NPN_GetAuthenticationInfo

« Gecko Plugin API Reference « Browser Side Plug-in 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

Document Tags and Contributors

 Contributors to this page: teoli, bsmedberg, jreschke, johshoff
 Last updated by: teoli,