Search in sources :

Example 1 with MasterTokenRestriction

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;
}
Also used : MasterToken(net.petafuel.styx.core.persistence.models.MasterToken) MasterTokenRestriction(net.petafuel.styx.core.persistence.models.MasterTokenRestriction) HashMap(java.util.HashMap)

Aggregations

HashMap (java.util.HashMap)1 MasterToken (net.petafuel.styx.core.persistence.models.MasterToken)1 MasterTokenRestriction (net.petafuel.styx.core.persistence.models.MasterTokenRestriction)1