GLX Application FrameworkGLX Application Framework 1.2 Internet IntegrationHow Can I Specify the Username/Password For a URL or Proxy Server?

How Can I Specify the Username/Password For a URL or Proxy Server?

Some web services require that you provide a valid username and password in order to access a URL. Some common means of authorization are Basic, Digest and NTLM. The framework provides some helpers that will handle authorization for you automatically.

URL Authorization Helpers

The authorization helper calls in the framework are accessed using glxurlauth_getProp and glxurlauth_setProp. Setting properties using these handlers is helpful in situations where you know (or have had the user provide) a username and password needed to access a URL or proxy server.

Properties That Provide Credentials For a URL

server username

server password

server domain

Properties That Provide Credentials For a Proxy Server

http proxy username

http proxy password

http proxy domain

Miscellaneous

prompt user for credentials: If true then the framework will attempt to display the glxappAuthenticate stack if valid credentials are required from the user in order to access a URL. Default is true.

An Example

## Don't display dialog for username/pass credentials
put glxurlauth_getProp("prompt user for credentials") into promptTheUser
glxurlauth_setProp "prompt user for credentials", false

## Set the username/password that the framework will
## use when the server asks for credentials. 
glxurlauth_setProp "server username", theUsername
glxurlauth_setProp "server password", thePassword

put "http://www.mydomain.com/URL/That/Requires/Authorization" into theURL
put URL theURL into theReturnedData

## Error checking/handle response data...

## Restore prompt setting
glxurlauth_setProp "prompt user for credentials", promptTheUser

This example shows how to provider the username and password for a URL you are trying to access in your program.

0 Comments

Add your comment

E-Mail me when someone replies to this comment