Subversion Repositories XServices

Rev

Blame | Last modification | View Log | Download | RSS feed

/*
 *   Copyright 2013 Brian Rosenberger (Brutex Network)
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
*/


package net.brutex.xservices.security;

import java.text.ParseException;
import java.util.Collection;
import java.util.Map;

import org.apache.log4j.Logger;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.Permission;
import org.apache.shiro.authz.permission.PermissionResolver;
import org.apache.shiro.config.Ini;
import org.apache.shiro.io.ResourceUtils;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.realm.text.IniRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.util.Nameable;
import org.apache.shiro.util.PermissionUtils;

// TODO: Auto-generated Javadoc
/* 
 * For later use. A Realm connects to a DS where Users/ Passes are defined
 * and allows Shiro to transparently work against different user/pass stores
 * (i.e. LDAP, Custom, etc.)
 *
 * @author Brian Rosenberger, bru(at)brutex.de
 *
 */
/**
 * The Class XServicesRealm.
 */
public class XServicesRealm extends IniRealm implements Nameable  {

        /** The logger. */
        private static Logger logger = Logger.getLogger(XServicesRealm.class);
        
        /** The name. */
        private String name;
        
        /* (non-Javadoc)
         * @see org.apache.shiro.realm.AuthorizingRealm#setName(java.lang.String)
         */
        @Override
        public void setName(String name) {
                this.name = name;
        }

        
        /**
         * Instantiates a new x services realm with default
         * 'shiro.ini' in classpath and {@link net.brutex.xservices.security.PermissionResolver PermissionResolver}.
         * 
         */
        public XServicesRealm() {
                super();
                this.setIni(Ini.fromResourcePath(ResourceUtils.CLASSPATH_PREFIX+"shiro.ini"));
                this.setPermissionResolver(new net.brutex.xservices.security.PermissionResolver());
                //this.setRolePermissionResolver(new RolePermissionResolver());
                init();
        }       
}