Package io.meeds.tenant.metamask.service
Class MetamaskLoginService
java.lang.Object
io.meeds.tenant.metamask.service.MetamaskLoginService
- All Implemented Interfaces:
org.picocontainer.Startable
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMetamaskLoginService(org.exoplatform.services.organization.OrganizationService organizationService, org.exoplatform.portal.config.UserACL userACL, org.exoplatform.web.security.security.SecureRandomService secureRandomService, TenantManagerService tenantManagerService, org.exoplatform.account.setup.web.AccountSetupService accountSetupService, io.meeds.portal.security.service.SecuritySettingService securitySettingService, org.exoplatform.container.xml.InitParams params) -
Method Summary
Modifier and TypeMethodDescriptiongenerateLoginMessage(javax.servlet.http.HttpSession session) Generates a new Login Message to sign by current user and store it inHttpSession.generateLoginMessage(javax.servlet.http.HttpSession session, boolean renew) Generates a new Login Message to sign by current user and store it inHttpSession.longgetLoginMessage(javax.servlet.http.HttpSession session) Retrieves Login Message to Sign with Metamask Generated and stored in HTTP SessiongetUserWithWalletAddress(String walletAddress) Retrieves User name with associated wallet AddressbooleanbooleanisAllowUserRegistration(String walletAddress) booleanbooleanisSuperUser(String walletAddress) booleanisTenantManager(String walletAddress) voidstart()voidstop()booleanvalidateSignedMessage(String walletAddress, String rawMessage, String signedMessage) Validates signed message by a wallet using Metamask
-
Field Details
-
LOGIN_MESSAGE_ATTRIBUTE_NAME
- See Also:
-
SECURE_ROOT_ACCESS_WITH_METAMASK_PARAM
- See Also:
-
ALLOWED_ROOT_ACCESS_WALLETS_PARAM
- See Also:
-
LOG
protected static final org.exoplatform.services.log.Log LOG
-
-
Constructor Details
-
MetamaskLoginService
public MetamaskLoginService(org.exoplatform.services.organization.OrganizationService organizationService, org.exoplatform.portal.config.UserACL userACL, org.exoplatform.web.security.security.SecureRandomService secureRandomService, TenantManagerService tenantManagerService, org.exoplatform.account.setup.web.AccountSetupService accountSetupService, io.meeds.portal.security.service.SecuritySettingService securitySettingService, org.exoplatform.container.xml.InitParams params)
-
-
Method Details
-
start
public void start()- Specified by:
startin interfaceorg.picocontainer.Startable
-
stop
public void stop()- Specified by:
stopin interfaceorg.picocontainer.Startable
-
isAllowUserRegistration
public boolean isAllowUserRegistration()- Returns:
- allowUserRegistration parameter value
-
isAllowUserRegistration
- Parameters:
walletAddress- wallet address that attempts to register- Returns:
- allowUserRegistration parameter value, else, it will checks whether the Tenant Manager has been registered to the tenant or not. If not regitered, allow to display the register form, else return false.
-
isTenantManager
- Parameters:
walletAddress- to check if it's of Tenant Manager- Returns:
- true is wallet address is of the Tenant Manager else return false.
-
isSuperUser
- Parameters:
walletAddress- wallet address- Returns:
- true if secure root access is allowed and designated wallet is allowed to access using root account
-
getUserWithWalletAddress
Retrieves User name with associated wallet Address- Parameters:
walletAddress- Ethereum Wallet Address- Returns:
- username
-
validateSignedMessage
Validates signed message by a wallet using Metamask- Parameters:
walletAddress- wallet Address (wallet public key)rawMessage- raw signed messagesignedMessage- encrypted message- Returns:
- true if the message has been decrypted successfully, else false
-
generateLoginMessage
Generates a new Login Message to sign by current user and store it inHttpSession. If renew = true, a new Token will be generated even if alread exists inHttpSession, else the token already generated will be returned- Parameters:
session-HttpSessionrenew- boolean- Returns:
- already existing token in
HttpSessionor a newly generated one
-
generateLoginMessage
Generates a new Login Message to sign by current user and store it inHttpSession. If a token already exists in session, it will be returned else a newly generated token will be returned- Parameters:
session-HttpSession- Returns:
- already existing token in
HttpSessionor a newly generated one
-
getLoginMessage
Retrieves Login Message to Sign with Metamask Generated and stored in HTTP Session- Parameters:
session-HttpSessionof current user- Returns:
- Login Message
-
isDeedTenant
public boolean isDeedTenant()- Returns:
- true if current instance if the one of a Tenant Management
-
getDeedId
public long getDeedId()- Returns:
- DEED NFT identifier
-