Top Description Methods
org.eclipse.jetty.security

public Interface LoginService

Known Direct Implementers
org.eclipse.jetty.security.SPNEGOLoginService, org.eclipse.jetty.security.jaas.JAASLoginService, org.eclipse.jetty.security.AbstractLoginService, org.eclipse.jetty.security.EmptyLoginService
Imports
java.security.Principal, java.util.function.Function, javax.security.auth.Subject, org.eclipse.jetty.server.Request, .Session

Login Service Interface.

The Login service provides an abstract mechanism for an Authenticator to check credentials and to create a UserIdentity using the set IdentityService.

Method Summary

Modifier and TypeMethod and Description
public IdentityService

Returns:

the IdentityService associated with this Login Service.
getIdentityService
()

Get the IdentityService associated with this Login Service.

public String

Returns:

Get the name of the login service (aka Realm name)
getName
()

public default UserIdentity

Returns:

A UserIdentity or null.
getUserIdentity
(Subject
The subject
subject
,
Principal
the userPrincipal
userPrincipal
,
boolean
If true, the getIdentityService() may be used to create a new UserIdentity.
create
)

Get or create a UserIdentity that is not authenticated by the LoginService.

public UserIdentity

Returns:

A UserIdentity if the credentials matched, otherwise null
login
(String
The username.
username
,
Object
The users credentials.
credentials
,
Request
The request or null
request
,
Function<Boolean, Session>
function to retrieve or create a session.
getOrCreateSession
)

Login a user.

public void
public void
setIdentityService(IdentityService
the IdentityService associated with this Login Service.
service
)

Set the IdentityService associated with this Login Service.

public boolean

Returns:

true if authentication has not been revoked for the user.
validate
(UserIdentity
The user to validate
user
)

Validate a user identity.

Method Detail

getIdentityServiceback to summary
public IdentityService getIdentityService()

Get the IdentityService associated with this Login Service.

Returns:IdentityService

the IdentityService associated with this Login Service.

getNameback to summary
public String getName()
Returns:String

Get the name of the login service (aka Realm name)

getUserIdentityback to summary
public default UserIdentity getUserIdentity(Subject subject, Principal userPrincipal, boolean create)

Get or create a UserIdentity that is not authenticated by the LoginService. Typically, this method is used when a user is separately authenticated, but the roles of this service are needed for authorization.

Parameters
subject:Subject

The subject

userPrincipal:Principal

the userPrincipal

create:boolean

If true, the getIdentityService() may be used to create a new UserIdentity.

Returns:UserIdentity

A UserIdentity or null.

loginback to summary
public UserIdentity login(String username, Object credentials, Request request, Function<Boolean, Session> getOrCreateSession)

Login a user.

Parameters
username:String

The username.

credentials:Object

The users credentials.

request:Request

The request or null

getOrCreateSession:Function<Boolean, Session>

function to retrieve or create a session.

Returns:UserIdentity

A UserIdentity if the credentials matched, otherwise null

logoutback to summary
public void logout(UserIdentity user)
setIdentityServiceback to summary
public void setIdentityService(IdentityService service)

Set the IdentityService associated with this Login Service.

Parameters
service:IdentityService

the IdentityService associated with this Login Service.

validateback to summary
public boolean validate(UserIdentity user)

Validate a user identity. Validate that a UserIdentity previously created by a call to login(String, Object, Request, Function) is still valid.

Parameters
user:UserIdentity

The user to validate

Returns:boolean

true if authentication has not been revoked for the user.