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

com.erigir.wrench.shiro.DefaultOauthCustomPrincipalBuilder Maven / Gradle / Ivy

Go to download

An extensible implementation of Apache Shiro that uses OAuth as its source with a provided Spring MVC configuration

There is a newer version: 2.2.16+16
Show newest version
package com.erigir.wrench.shiro;

import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;

/**
 * The default system just grants the default roles and privs to all
 * oauth authenticated users - modify this to handle your own cases.  You
 * can use this class if you want EVERY person who gets authenticated to
 * have the same roles and privileges (or if you only care about authentication)
 *
 * Created by chrweiss on 5/29/15.
 */
public class DefaultOauthCustomPrincipalBuilder implements OauthCustomPrincipalBuilder {

    private Set defaultRoles = new TreeSet<>();
    private Set defaultPermissions = new TreeSet<>();

    public void updatePrincipal(OauthPrincipal data) {
        Objects.requireNonNull(data, "The Oauth principal object must be non-null");
        Objects.requireNonNull(defaultRoles, "The defaultRoles object must be non-null");
        Objects.requireNonNull(defaultPermissions, "The defaultPermissions object must be non-null");

        data.setPermissions(defaultPermissions);
        data.setRoles(defaultRoles);
    }

    public Set getDefaultRoles() {
        return defaultRoles;
    }

    public void setDefaultRoles(Set defaultRoles) {
        this.defaultRoles = defaultRoles;
    }

    public Set getDefaultPermissions() {
        return defaultPermissions;
    }

    public void setDefaultPermissions(Set defaultPermissions) {
        this.defaultPermissions = defaultPermissions;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy