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

at.spardat.xma.plugins.dummy.DummyAuthorisation Maven / Gradle / Ivy

There is a newer version: 6.0.2
Show newest version
/*******************************************************************************
 * Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     s IT Solutions AT Spardat GmbH - initial API and implementation
 *******************************************************************************/

/*
 * Created on 13.06.2003
 *
 */
package at.spardat.xma.plugins.dummy;

import java.util.Set;

import javax.security.auth.Subject;

import at.spardat.xma.security.Authorisation;

/**
 * Dummy implementation of an authorisation plugin.
 * This implementation allows everything to every authenticated user.
 * All numerical values are zero.
 * This plugin can be used on client and server side.
 *
 * @author s2877
 */
public class DummyAuthorisation implements Authorisation {

    /**
     * Check if the given user is alowed to perform the given function.
     * Every authenticated user is allowed every function.
     * @param subject the subject as returned by the {@link DummyLoginModule}
     * @param function a String identifying the desired operation
     * @return true if the subject is really form the {@link DummyLoginModule}
     */
    public boolean isAuthorized(Subject subject, String function) {
        Set knownPrinces = subject.getPrincipals(DummyContext.class);
        if(knownPrinces.size()<1) return false;
        else return true;
    }

    /**
     * Return the numeric value associated with the given user and
     * the given function. e.g. a money limit.
     * @param subject the subject as returned by the {@link DummyLoginModule}
     * @param function a String identifying the desired operation
     * @return 0
     */
    public long getLongValue(Subject subject, String function) {
        return 0;
    }

    /**
     * Return the numeric value associated with the given user and
     * the given function. e.g. a money limit.
     * @param subject the subject as returned by the {@link DummyLoginModule}
     * @param function a String identifying the desired operation
     * @return 0
     */
    public double getDoubleValue(Subject subject, String function) {
        return 0;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy