|| At A Glance | About This Document | Class Description | Summaries | Properties | Methods | Events | See Also ||

The HotJavaTM Component Series

HotJava Authenticator Bean


Class At A Glance

Class Name: AuthenticatorBean
Extends: Component
Implements: HttpAuthenticator, Externalizable

Purpose

The Authenticator bean is an invisible JavaBeans component intended for use with the HotJava HTML Component. It allows connections to secure sites and raises a dialog as necessary. Note that this version is a default implementation of the interface, and although it supports http authentication, it does not yet support SSL.
Key Properties
none
Creation
AuthenticatorBean()
Commonly Used Methods
none

About This Document

Audience
This document describes the HotJava HTML Component. It is intended for both "component assemblers" who will be instantiating and connecting the bean in builder applications as well as Java developers who will be programatically accessing the component. It assumes that you are already familiar with JavaBeans. If terms like property, event, method, introspection, or serialization are unfamiliar, you may want to refer to the JavaBeans documentation or take the JavaBeans tutorial.
Table of Contents

Class Description

Overview
The Authenticator bean is an invisible JavaBeans component intended for use with the HotJava HTML Component. The Authenticator bean allows for connections to secure servers by merely adding this component to the same container as the HTML component. Note that this version is a default implementation of the interface, and although it supports http authentication, it does not yet support SSL.

This is about as simple as a bean interface can get. Although is has a few properties, most are read-only and none are bound or constrained. Therefore, the component fires no events.

Introspection
No BeanInfo class is provided. Introspection relies on low-level reflection to identify the properties and events of the Authenticator bean. All public methods are exposed by default.
Example Use
In the beanbox or another JavaBeans-enabled builder application, simply instantiate a HotJava HTML component and Authenticator bean in the same container.

Summaries


Property Summary

String userName - the current user (rw)
String password - password for authorizing a connection (w)
int requestingPort - the port used by the requestor (ro)
String requestingScheme - the scheme being requested (ro)
InetAddress requestingSite - the internet address of the requesting site (ro)
URL requestingURL - the URL of the requestor (ro)
Certificate userCertificate - SSL: Not yet implemented (rw)
Certificate[] siteCertificate - SSL: Not yet implemented (ro)
String requestingPurpose - SSL: Not yet implemented (ro)
boolean trusted - SSL: Not yet implemented (ro)

Method Summary

instantiation AuthenticatorBean()
accessing properites getUsername()
setUsername()
setPassword()
getRequestingSite()
getRequestingPort()
getRequestingPrompt()
getRequestingScheme()
getRequestingURL()
SSL (not yet implemented)   getUserCertificate()
setUserCertificate()
getSiteCertificate()
getRequestingPurpose()
authorize()
isTrusted()

Event Summary

The Authenticator bean neither fires events nor implements any EventListener interfaces.

Alphabetical Reference


Properties

password - password for authorizing a connection
Type: String
Get: none
Set: setPassword()

requestingPort - the port used by the requestor
Type: int
Get: getRequestingPort()
Set: none

requestingPurpose - SSL: Not yet implemented, always null
Type: String
Get: getRequestingPurpose()
Set: none

requestingScheme - the scheme being requested
Type: String
Get: getRequestingScheme()
Set: none

requestingSite - the internet address of the requesting site
Type: InetAddress
Get: getRequestingSite()
Set: none

requestingURL - the URL of the requestor
Type: URL
Get: getRequestingURL()
Set: none

siteCertificate - SSL: Not yet implemented, always null
Type: Certificate[]
Get: getSiteCertificate()
Set: none

userCertificate - SSL: Not yet implemented, always null
Type: Certificate
Get: getUserCertificate()
Set: setUserCertificate()

userName - the current user
Type: String
Get: getUsername()
Set: setUsername()

trusted - SSL: Not yet implemented, always false
Type: boolean
Get: isTrusted()
Set: none


Methods

boolean authorize(Frame frame, boolean lastFailed)
This method is called by the system when authorization is needed, and returns true when the user and password info has been set and the user wishes to continue. It returns false if the user wishes to cancel the action requiring authorization. lastFailed is true if the last attempt to authorize failed. The frame parameter can be used to present a dialog to the user.
The default implementation currently always returns false.

AuthenticatorBean()
The default constructor. This establishes the bean as the default authentication mechanism.

int getRequestingPort()
Get the requesting port property. This is set to the port used by the requestor.

String getRequestingPrompt()
Get the requesting prompt property. Returns the prompt string given by the requestor.

String getRequestingPurpose()
Get the requesting purpose property. Set when a site is requesting trust. The default implementation currently returns null.

String getRequestingScheme()
Get the scheme property. Set to the scheme being requested.

InetAddress getRequestingSite()
Get the Requesting site property. This is set to the internet address of the requesting site.

URL getRequestingURL()
Get the URL property. Set to the URL of the requestor.

Certificate[] getSiteCertificate()
Get the site certificate property. This is set by a site requesting trust. The default implementation currently returns null.

Certificate getUserCertificate()
Get the User Certificate property. The default implementation currently returns null.
See also: setUserCertificate().

String getUsername()
Get the user name property. This may be set to a default (current) user by the system before authentication is requested.
See also: setUsername().

boolean isTrusted(Frame frame)
Trust has been requested. This method is called by the system to determine if a site's certificate is trusted by the user. This method should return true if the user trusts the site's certification for the desired purpose. Some types of trust may also require the user to set a certificate as well. The Frame parameter can be used to present a dialog to the user.
The default implementation currently always returns false.

void setPassword(String pw)
Set the password property. This must be set before authorizing connection.

void setUserCertificate(Certificate)
Set the User Certificate property. This is set to provide client authorization. Does nothing in this default implementation.
See also: getUserCertificate().

void setUsername(String username)
Set the user name property. This may be set to a default (current) user by the system before authentication is requested.
See also: getUsername().

Events

The Authenticator bean neither fires events nor implements any EventListener interfaces.

See Also

Related Topics
HotJava Browser Components
HotJava Document Stack Bean
HotJava HTML Component
HotJava System State Bean

|| At A Glance | About This Document | Class Description | Summaries | Properties | Methods | Events | See Also ||

HotJava Components version 1.1.2