public class LdapAuthProvider extends Object implements AuthRepository
Repository.Meta
Modifier and Type | Field and Description |
---|---|
protected static String[] |
non_sasl_mechs |
protected static String[] |
sasl_mechs |
static String |
USER_DN_PATTERN_KEY
Example:
uid=%s,ou=people,dc=xmpp-test,dc=org |
DATA_KEY, DIGEST_ID_KEY, DIGEST_KEY, MACHANISM_KEY, PASSWORD_KEY, PROTOCOL_KEY, PROTOCOL_VAL_NONSASL, PROTOCOL_VAL_SASL, REALM_KEY, RESULT_KEY, SERVER_NAME_KEY, USER_ID_KEY, USERNAME_KEY
Constructor and Description |
---|
LdapAuthProvider() |
Modifier and Type | Method and Description |
---|---|
void |
addUser(BareJID user,
String password)
Describe
addUser method here. |
boolean |
digestAuth(BareJID user,
String digest,
String id,
String alg)
Deprecated.
|
String |
getPassword(BareJID user) |
String |
getResourceUri()
getResourceUri method returns database connection string. |
long |
getUsersCount()
This method is only used by the server statistics component to report
number of registered users.
|
long |
getUsersCount(String domain)
This method is only used by the server statistics component to report
number of registered users for given domain.
|
void |
initRepository(String resource_uri,
Map<String,String> params)
The method is called to initialize the data repository.
|
boolean |
isUserDisabled(BareJID user) |
void |
logout(BareJID user)
Describe
logout method here. |
boolean |
otherAuth(Map<String,Object> props)
Describe
otherAuth method here. |
boolean |
plainAuth(BareJID user,
String password)
Deprecated.
|
void |
queryAuth(Map<String,Object> authProps)
queryAuth returns mechanisms available for authentication. |
void |
removeUser(BareJID user)
Describe
removeUser method here. |
void |
setUserDisabled(BareJID user,
Boolean value) |
void |
updatePassword(BareJID user,
String password)
Describe
updatePassword method here. |
protected static final String[] non_sasl_mechs
protected static final String[] sasl_mechs
public static final String USER_DN_PATTERN_KEY
uid=%s,ou=people,dc=xmpp-test,dc=org
public void addUser(BareJID user, String password) throws UserExistsException, TigaseDBException
AuthRepository
addUser
method here.addUser
in interface AuthRepository
user
- a BareJID
valuepassword
- a String
valueUserExistsException
- if an error occursTigaseDBException
- if an error occurs@Deprecated public boolean digestAuth(BareJID user, String digest, String id, String alg) throws UserNotFoundException, TigaseDBException, AuthorizationException
AuthRepository
digestAuth
method performs non-sasl, digest authentication
as described in non-sasl authentication
XEP-0078
For now it is empty and always returns false
as I don't
have description for database with passwords.digestAuth
in interface AuthRepository
user
- a BareJID
value of user namedigest
- a String
value password digest sumid
- a String
value session ID used for digest sum
calculation.alg
- a String
value of algorithm ID used for digest sum
calculation.boolean
value true
on successful
authentication, false
on authentication failure.UserNotFoundException
- if an given user name is not found in
the authentication repository.TigaseDBException
- if an error occurs during during accessing
database;AuthorizationException
- if an error occurs during authentication
process.public String getResourceUri()
AuthRepository
getResourceUri
method returns database connection string.getResourceUri
in interface AuthRepository
String
value of database connection string.public long getUsersCount()
AuthRepository
getUsersCount
in interface AuthRepository
long
number of registered users in the repository.public long getUsersCount(String domain)
AuthRepository
getUsersCount
in interface AuthRepository
long
number of registered users in the repository.public void initRepository(String resource_uri, Map<String,String> params) throws DBInitException
Repository
resource_uri
parameter as the database connection string or via params
map if
the required repository parameters are more complex or both.initRepository
in interface Repository
resource_uri
- value in most cases representing the database connection string.params
- is a Map
with repository properties necessary to initialize
and perform all the functions. The initialization parameters are implementation dependent.DBInitException
- if there was an error during repository initialization.
Some implementations, though, perform so called lazy initialization so even though there
is a problem with the underlying repository it may not be signaled through this method
call.public void logout(BareJID user) throws UserNotFoundException, TigaseDBException
AuthRepository
logout
method here.logout
in interface AuthRepository
user
- a BareJID
valueUserNotFoundException
- if an error occursTigaseDBException
- if an error occurspublic boolean otherAuth(Map<String,Object> props) throws UserNotFoundException, TigaseDBException, AuthorizationException
AuthRepository
otherAuth
method here.otherAuth
in interface AuthRepository
props
- a Map
valueboolean
valueUserNotFoundException
- if an error occursTigaseDBException
- if an error occursAuthorizationException
- if an error occurs@Deprecated public boolean plainAuth(BareJID user, String password) throws UserNotFoundException, TigaseDBException, AuthorizationException
AuthRepository
plainAuth
method performs non-sasl, plain authentication
as described in non-sasl authentication
XEP-0078.plainAuth
in interface AuthRepository
user
- a BareJID
value of user namepassword
- a String
value of plain user password.boolean
value true
on successful
authentication, false
on authentication failure.UserNotFoundException
- if an given user name is not found in
the authentication repository.TigaseDBException
- if an error occurs during during accessing
database;AuthorizationException
- if an error occurs during authentication
process.public void queryAuth(Map<String,Object> authProps)
AuthRepository
queryAuth
returns mechanisms available for authentication.queryAuth
in interface AuthRepository
authProps
- a Map
value with parameters for authentication.public void removeUser(BareJID user) throws UserNotFoundException, TigaseDBException
AuthRepository
removeUser
method here.removeUser
in interface AuthRepository
user
- a BareJID
valueUserNotFoundException
- if an error occursTigaseDBException
- if an error occurspublic void updatePassword(BareJID user, String password) throws UserNotFoundException, TigaseDBException
AuthRepository
updatePassword
method here.updatePassword
in interface AuthRepository
user
- a BareJID
valuepassword
- a String
valueUserNotFoundException
TigaseDBException
- if an error occurspublic String getPassword(BareJID user) throws UserNotFoundException, TigaseDBException
getPassword
in interface AuthRepository
UserNotFoundException
TigaseDBException
public boolean isUserDisabled(BareJID user) throws UserNotFoundException, TigaseDBException
isUserDisabled
in interface AuthRepository
UserNotFoundException
TigaseDBException
public void setUserDisabled(BareJID user, Boolean value) throws UserNotFoundException, TigaseDBException
setUserDisabled
in interface AuthRepository
UserNotFoundException
TigaseDBException
Copyright © 2018 "Tigase, Inc.". All rights reserved.