Package com.axelor.auth.db.repo
Class UserTokenRepository
java.lang.Object
com.axelor.db.JpaRepository<UserToken>
com.axelor.auth.db.repo.AbstractUserTokenRepository
com.axelor.auth.db.repo.UserTokenRepository
- All Implemented Interfaces:
Repository<UserToken>
-
Field Summary
Fields inherited from class com.axelor.db.JpaRepository
modelClass -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringnormalizeAllowedIps(String allowedIps) Normalizes a comma-separated list of IP addresses or CIDR ranges, removing duplicates.Populate the given json map with additional data.Saves the API key, normalizing its comma-separated allowed IPs.Validate the given json map before persisting.Methods inherited from class com.axelor.auth.db.repo.AbstractUserTokenRepository
findByNameMethods inherited from class com.axelor.db.JpaRepository
all, all, copy, create, fields, find, findById, findByIds, flush, getReferenceById, isPermitted, isPermitted, merge, of, persist, refresh, remove
-
Constructor Details
-
UserTokenRepository
public UserTokenRepository()
-
-
Method Details
-
findByKey
-
save
Saves the API key, normalizing its comma-separated allowed IPs.- Specified by:
savein interfaceRepository<UserToken>- Overrides:
savein classJpaRepository<UserToken>- Parameters:
entity- the entity object to save- Returns:
- an instance of the entity with saved state
- Throws:
IllegalArgumentException- if any allowed IP is not a valid IP address or CIDR range
-
normalizeAllowedIps
Normalizes a comma-separated list of IP addresses or CIDR ranges, removing duplicates.- Parameters:
allowedIps- comma-separated IP addresses or CIDR ranges- Returns:
- the normalized list, separated by
", ", ornullif empty - Throws:
IllegalArgumentException- if any entry is not a valid IP address or CIDR range
-
populate
Description copied from interface:RepositoryPopulate the given json map with additional data.This method is called before returning the json data as response.
- Specified by:
populatein interfaceRepository<UserToken>- Overrides:
populatein classJpaRepository<UserToken>- Parameters:
json- the json map to populatecontext- the context- Returns:
- the json map itself
-
validate
Description copied from interface:RepositoryValidate the given json map before persisting.This method is called before the json map is converted to model object.
- Specified by:
validatein interfaceRepository<UserToken>- Overrides:
validatein classJpaRepository<UserToken>- Parameters:
json- the json map to validatecontext- the context- Returns:
- validated json map
-