![JAR search and dependency download from the Maven repository](/logo.png)
net.redpipe.engine.security.VertxPermissionAnnotationHandler Maven / Gradle / Ivy
package net.redpipe.engine.security;
import java.lang.annotation.Annotation;
import io.reactivex.Single;
import io.vertx.reactivex.ext.auth.User;
public class VertxPermissionAnnotationHandler extends AuthorizingAnnotationHandler {
@Override
public Single assertAuthorized(Annotation authzSpec) {
if(authzSpec instanceof RequiresPermissions){
User user = getUser();
if(user == null)
return Single.error(new AuthorizationException("User required"));
Single ret = Single.just(true);
for(String perm : ((RequiresPermissions) authzSpec).value()){
ret = user.rxIsAuthorised(perm).zipWith(ret, (a, b) -> a && b);
}
return ret;
}
return Single.just(true);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy