/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.identity.User
 */
package com.l7tech.server.util;

import com.l7tech.identity.User;
import java.security.AccessController;
import java.util.Set;
import java.util.logging.Logger;
import javax.security.auth.Subject;

public class JaasUtils {
    protected static final Logger logger = Logger.getLogger(JaasUtils.class.getName());

    private JaasUtils() {
    }

    public static User getCurrentUser() {
        Subject subject = JaasUtils.getCurrentSubject();
        if (subject == null) {
            return null;
        }
        Set<User> set = subject.getPrincipals(User.class);
        if (set == null || set.isEmpty()) {
            return null;
        }
        return set.iterator().next();
    }

    public static Subject getCurrentSubject() {
        return Subject.getSubject(AccessController.getContext());
    }
}

