Class MongoRealmAuthenticator
- java.lang.Object
-
- org.restheart.security.plugins.authenticators.MongoRealmAuthenticator
-
- All Implemented Interfaces:
io.undertow.security.idm.IdentityManager,ConfigurablePlugin,Plugin,Authenticator
public class MongoRealmAuthenticator extends Object implements Authenticator
- Author:
- Andrea Di Cesare <andrea@softinstigate.com>
-
-
Field Summary
Fields Modifier and Type Field Description static StringX_FORWARDED_ACCOUNT_IDstatic StringX_FORWARDED_ROLE
-
Constructor Summary
Constructors Constructor Description MongoRealmAuthenticator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringaccountIdTrasformer(String id)Override this method to trasform the account id.booleancheckUserCollection()longcountAccounts()voidcreateDefaultAccount()PwdCredentialAccountfindAccount(String accountId)IntegergetBcryptComplexity()StringgetPropPassword()StringgetUsersCollection()StringgetUsersDb()static io.undertow.util.HttpStringgetXForwardedAccountIdHeaderName()static io.undertow.util.HttpStringgetXForwardedHeaderName(String suffix)static io.undertow.util.HttpStringgetXForwardedRolesHeaderName()booleanisBcryptHashedPassword()voidsetConf(Map<String,Object> args)voidsetMongoClient(com.mongodb.MongoClient mclient)voidsetRegistry(PluginsRegistry registry)voidsetUsersDb(String usersDb)io.undertow.security.idm.Accountverify(io.undertow.security.idm.Account account)io.undertow.security.idm.Accountverify(io.undertow.security.idm.Credential credential)io.undertow.security.idm.Accountverify(String id, io.undertow.security.idm.Credential credential)
-
-
-
Field Detail
-
X_FORWARDED_ACCOUNT_ID
public static final String X_FORWARDED_ACCOUNT_ID
- See Also:
- Constant Field Values
-
X_FORWARDED_ROLE
public static final String X_FORWARDED_ROLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setMongoClient
public void setMongoClient(com.mongodb.MongoClient mclient)
-
setRegistry
public void setRegistry(PluginsRegistry registry)
-
verify
public io.undertow.security.idm.Account verify(io.undertow.security.idm.Account account)
- Specified by:
verifyin interfaceAuthenticator- Specified by:
verifyin interfaceio.undertow.security.idm.IdentityManager
-
verify
public io.undertow.security.idm.Account verify(String id, io.undertow.security.idm.Credential credential)
- Specified by:
verifyin interfaceAuthenticator- Specified by:
verifyin interfaceio.undertow.security.idm.IdentityManager
-
getBcryptComplexity
public Integer getBcryptComplexity()
- Returns:
- the bcryptComplexity
-
isBcryptHashedPassword
public boolean isBcryptHashedPassword()
-
verify
public io.undertow.security.idm.Account verify(io.undertow.security.idm.Credential credential)
- Specified by:
verifyin interfaceAuthenticator- Specified by:
verifyin interfaceio.undertow.security.idm.IdentityManager
-
accountIdTrasformer
protected String accountIdTrasformer(String id)
Override this method to trasform the account id. By default it returns the id without any transformation. For example, it could be overridden to force the id to be lowercase.- Parameters:
id- the account id- Returns:
- the trasformed account Id (default is identity)
-
getPropPassword
public String getPropPassword()
- Returns:
- the propPassword
-
getXForwardedHeaderName
public static io.undertow.util.HttpString getXForwardedHeaderName(String suffix)
-
getXForwardedAccountIdHeaderName
public static io.undertow.util.HttpString getXForwardedAccountIdHeaderName()
-
getXForwardedRolesHeaderName
public static io.undertow.util.HttpString getXForwardedRolesHeaderName()
-
checkUserCollection
public boolean checkUserCollection()
-
countAccounts
public long countAccounts()
-
createDefaultAccount
public void createDefaultAccount()
-
findAccount
public PwdCredentialAccount findAccount(String accountId)
-
getUsersDb
public String getUsersDb()
- Returns:
- the usersDb
-
setUsersDb
public void setUsersDb(String usersDb)
- Parameters:
usersDb- the usersDb to set
-
getUsersCollection
public String getUsersCollection()
- Returns:
- the usersCollection
-
-