br.com.diego.shiro.SomeBean.java Source code

Java tutorial

Introduction

Here is the source code for br.com.diego.shiro.SomeBean.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.diego.shiro;

import javax.enterprise.context.RequestScoped;
import javax.inject.Named;

import org.apache.shiro.SecurityUtils;

/**
 *
 * @author diego
 */
@Named
@RequestScoped
@ShiroSecured
public class SomeBean {

    public void doSomethingWhichIsOnlyAllowedByADMIN() {
        SecurityUtils.getSubject().checkRole("ADMIN");

    }

}