All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.brutusin.demo.SecurityExceptionAction Maven / Gradle / Ivy

There is a newer version: 1.9.2
Show newest version
package org.brutusin.demo;

import org.brutusin.rpc.http.Cacheable;
import org.brutusin.rpc.http.HttpActionSupport;
import org.brutusin.rpc.http.SafeAction;

public class SecurityExceptionAction extends SafeAction {

    @Override
    public Cacheable execute(Void input) throws Exception {
        String name;
        if (HttpActionSupport.getInstance().getUserPrincipal() == null) {
            name = null;
        } else {
            name = HttpActionSupport.getInstance().getUserPrincipal().getName();
        }
        throw new SecurityException("Forbidden access. User principal: '" + name + "'");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy