<commit_before>package org.osiam.addons.administration.config;

import java.util.Collection;

import javax.inject.Inject;

import org.osiam.addons.administration.model.SessionData;
import org.springframework.security.access.AccessDecisionManager;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.authentication.InsufficientAuthenticationException;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;

/**
 * This class is responsible for decide admin-access.
 */
@Component
public class AdminAccessDecisionManager implements AccessDecisionManager {

    @Inject
    private SessionData session;

    @Override
    public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes){
        // if there are no access-token in session
        if (session.getAccesstoken() == null) {
            throw new AccessDeniedException("There is no accesstoken in session!");
        }
    }

    @Override
    public boolean supports(ConfigAttribute attribute) {
        return true;
    }

    @Override
    public boolean supports(Class<?> clazz) {
        return true;
    }
}
<commit_msg>remove unused import<commit_after>package org.osiam.addons.administration.config;

import java.util.Collection;

import javax.inject.Inject;

import org.osiam.addons.administration.model.SessionData;
import org.springframework.security.access.AccessDecisionManager;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;

/**
 * This class is responsible for decide admin-access.
 */
@Component
public class AdminAccessDecisionManager implements AccessDecisionManager {

    @Inject
    private SessionData session;

    @Override
    public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes){
        // if there are no access-token in session
        if (session.getAccesstoken() == null) {
            throw new AccessDeniedException("There is no accesstoken in session!");
        }
    }

    @Override
    public boolean supports(ConfigAttribute attribute) {
        return true;
    }

    @Override
    public boolean supports(Class<?> clazz) {
        return true;
    }
}

{'fraction_non_alphanumeric': 0.08103792415169661, 'fraction_numerical': 0.0, 'mean_word_length': 4.20997920997921, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3637576', 'n_tokens_mistral': 623, 'n_tokens_neox': 616, 'n_words': 156}