Subversion Repositories XServices

Compare Revisions

Ignore whitespace Rev 146 → Rev 191

/xservices/trunk/src/java/net/brutex/xservices/security/XServicesRealm.java
17,24 → 17,30
 
package net.brutex.xservices.security;
 
import java.text.ParseException;
import java.util.Collection;
import java.util.Map;
import org.apache.logging.log4j.Logger;
 
import org.apache.log4j.Logger;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
 
import javax.servlet.ServletContext;
 
import org.apache.catalina.core.ApplicationContext;
import org.apache.logging.log4j.LogManager;
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.authz.SimpleAuthorizationInfo;
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.realm.text.TextConfigurationRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.util.Nameable;
import org.apache.shiro.util.PermissionUtils;
import org.apache.shiro.web.env.IniWebEnvironment;
import org.apache.shiro.web.util.WebUtils;
 
// TODO: Auto-generated Javadoc
/*
51,7 → 57,7
public class XServicesRealm extends IniRealm implements Nameable {
 
/** The logger. */
private static Logger logger = Logger.getLogger(XServicesRealm.class);
private final Logger logger = LogManager.getLogger();
/** The name. */
private String name;
70,11 → 76,25
* 'shiro.ini' in classpath and {@link net.brutex.xservices.security.PermissionResolver PermissionResolver}.
*
*/
public XServicesRealm() {
super();
this.setIni(Ini.fromResourcePath(ResourceUtils.CLASSPATH_PREFIX+"shiro.ini"));
/* needs review */
URI classesRootDir;
try {
classesRootDir = getClass().getProtectionDomain().getCodeSource().getLocation().toURI();
String dir = classesRootDir.toString().replaceAll("%20", " ");
dir = dir.substring(0, dir.lastIndexOf("WEB-INF"));
this.setIni(Ini.fromResourcePath(dir+"/WEB-INF/shiro.ini"));
} catch (URISyntaxException e) {
logger.error(e.getMessage(), e);
e.printStackTrace();
}
this.setPermissionResolver(new net.brutex.xservices.security.PermissionResolver());
//this.setRolePermissionResolver(new RolePermissionResolver());
init();
}
}
 
 
}