2.3.4. DefaultLoginCredentials
The
DefaultLoginCredentials
bean is provided by PicketLink as a convenience, and is intended to serve as a general purpose Credentials
implementation suitable for a variety of use cases. It supports the setting of a userId
and credential
property, and provides convenience methods for working with text-based passwords. It is a request-scoped bean and is also annotated with @Named
so as to make it accessible directly from the view layer.
A view technology with support for EL binding (such as JSF) can access the
DefaultLoginCredentials
bean directly via its bean name, loginCredentials
. The following code snippet shows some JSF markup that binds the controls of a login form to DefaultLoginCredentials
:
<div class="loginRow"> <h:outputLabel for="name" value="Username" styleClass="loginLabel"/> <h:inputText id="name" value="#{loginCredentials.userId}"/> </div> <div class="loginRow"> <h:outputLabel for="password" value="Password" styleClass="loginLabel"/> <h:inputSecret id="password" value="#{loginCredentials.password}" redisplay="true"/> </div>