com.jevontech.wabl.services.implementation.SecurityServiceImpl.java Source code

Java tutorial

Introduction

Here is the source code for com.jevontech.wabl.services.implementation.SecurityServiceImpl.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 com.jevontech.wabl.services.implementation;

/**
 *
 * @author jeroen
 */
//import com.brahalla.Cerberus.service.SecurityService;

import com.jevontech.wabl.services.SecurityService;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;

@Service
public class SecurityServiceImpl implements SecurityService {

    @Override
    public Boolean hasProtectedAccess() {
        return (SecurityContextHolder.getContext().getAuthentication().getAuthorities()
                .contains(new SimpleGrantedAuthority("ADMIN")));
    }

}