
net.sf.esfinge.gamification.guardian.auth.ranking.DenyRankingAuthorizer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gamification Show documentation
Show all versions of gamification Show documentation
The Esfinge Gamification is a matadata based framework applicable to systems requiring an gamification logic, regardless of the domain.
The newest version!
package net.sf.esfinge.gamification.guardian.auth.ranking;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.esfinge.guardian.authorizer.Authorizer;
import org.esfinge.guardian.context.AuthorizationContext;
import net.sf.esfinge.gamification.achievement.Ranking;
import net.sf.esfinge.gamification.annotation.auth.ranking.DenyRanking;
import net.sf.esfinge.gamification.guardian.AuthorizationProcessor;
public class DenyRankingAuthorizer extends AuthorizationProcessor implements Authorizer {
@Override
public Boolean authorize(AuthorizationContext context, DenyRanking securityAnnotation) {
Ranking ranking = (Ranking) process(context, securityAnnotation);
if (Objects.nonNull(ranking) && ranking.getName().equals(securityAnnotation.achievementName())) {
Logger.getLogger(this.getClass().getName()).log(Level.WARNING,
"Unauthorized accesss: Denied achievement: Ranking " + securityAnnotation.achievementName());
return false;
}
Logger.getLogger(this.getClass().getName()).log(Level.INFO,
"Authorized accesss: Required achievement: Ranking " + securityAnnotation.achievementName());
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy