UserSource

public interface UserSource

UserSources are sources for users - i.e. they authenticate users and contain basic information about users.

UserSources let you

check if a user exists - isUserExisting(String)authenticate a user via a password - isValid(String,String)get the default UserStatus - getDefaultUserStatus(String)get the default email address - getDefaultUserEmail(String)retrieve a users roles - resolveRolesForUsername(String) The default email and default UserStatus might be overridden by other settings in CaosDB - that’s why they are called “default”.

Also, the user’s roles might be overridden by the internal user source InternalUserSource.

A UserSource is configured via setMap(Map).

Author:

Timm Fitschen (t.fitschen@indiscale.com)

Methods

getDefaultUserEmail

public String getDefaultUserEmail(String username)

Return the email address of that user, or null if none is available as per this user source.

This method does not check if a user exists. So it will return null for unknown users.

Parameters:
  • username

Returns:

The email address or null

getDefaultUserStatus

public UserStatus getDefaultUserStatus(String username)

Return the UserStatus of that user.

Parameters:
  • username

Returns:

The user status of that user

getName

public String getName()

Every UserSource has a unique name, e.g. PAM, CaosDB (which is default name of the internal user source InternalUserSource).

Returns:

name

isUserExisting

public boolean isUserExisting(String username)

Check if a user exists.

Parameters:
  • username

Returns:

true iff this user source knows a user with that name

isValid

public boolean isValid(String username, String password)

Check if the user can be authenticated by the given password.

Parameters:
  • username

  • password

Returns:

true iff the password was correct.

resolveRolesForUsername

public Set<String> resolveRolesForUsername(String username)

Return all roles that a user is associated with.

Parameters:
  • username

Returns:

a user’s roles

setMap

public void setMap(Map<String, String> map)

Configure this user source. The needed parameters are to be defined and documented by the implementations.

Parameters:
  • map – the configuration