use of net.petafuel.styx.core.persistence.models.MasterTokenRestriction in project styx by petafuel.
the class AccessTokenFilterUnitTest method prepareMasterToken.
/**
* helper method which sets up a masterToken object with given service Type and maxUsage
*
* @param serviceType string service type for which maxUsages will be set
* @param maxUsage amount of maxUsage for serviceType
* @return object of MasterToken
*/
private MasterToken prepareMasterToken(String serviceType, Integer maxUsage) {
MasterToken masterToken = new MasterToken();
MasterTokenRestriction masterTokenRestriction = new MasterTokenRestriction();
masterTokenRestriction.setMaxUsages(maxUsage);
Map<String, MasterTokenRestriction> restrictionMap = new HashMap<>();
restrictionMap.put(serviceType, masterTokenRestriction);
masterToken.setRestrictions(restrictionMap);
return masterToken;
}
Aggregations