Subversion Repositories XServices

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
146 brianR 1
/*
2
 *   Copyright 2013 Brian Rosenberger (Brutex Network)
3
 *
4
 *   Licensed under the Apache License, Version 2.0 (the "License");
5
 *   you may not use this file except in compliance with the License.
6
 *   You may obtain a copy of the License at
7
 *
8
 *       http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *   Unless required by applicable law or agreed to in writing, software
11
 *   distributed under the License is distributed on an "AS IS" BASIS,
12
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *   See the License for the specific language governing permissions and
14
 *   limitations under the License.
15
*/
16
 
17
 
18
package net.brutex.xservices.security;
19
 
20
import java.text.ParseException;
21
import java.util.Collection;
22
import java.util.Map;
23
 
24
import org.apache.log4j.Logger;
25
import org.apache.shiro.authc.AuthenticationException;
26
import org.apache.shiro.authc.AuthenticationInfo;
27
import org.apache.shiro.authc.AuthenticationToken;
28
import org.apache.shiro.authz.AuthorizationInfo;
29
import org.apache.shiro.authz.Permission;
30
import org.apache.shiro.authz.permission.PermissionResolver;
31
import org.apache.shiro.config.Ini;
32
import org.apache.shiro.io.ResourceUtils;
33
import org.apache.shiro.realm.AuthorizingRealm;
34
import org.apache.shiro.realm.text.IniRealm;
35
import org.apache.shiro.subject.PrincipalCollection;
36
import org.apache.shiro.util.Nameable;
37
import org.apache.shiro.util.PermissionUtils;
38
 
39
// TODO: Auto-generated Javadoc
40
/*
41
 * For later use. A Realm connects to a DS where Users/ Passes are defined
42
 * and allows Shiro to transparently work against different user/pass stores
43
 * (i.e. LDAP, Custom, etc.)
44
 *
45
 * @author Brian Rosenberger, bru(at)brutex.de
46
 *
47
 */
48
/**
49
 * The Class XServicesRealm.
50
 */
51
public class XServicesRealm extends IniRealm implements Nameable  {
52
 
53
	/** The logger. */
54
	private static Logger logger = Logger.getLogger(XServicesRealm.class);
55
 
56
	/** The name. */
57
	private String name;
58
 
59
	/* (non-Javadoc)
60
	 * @see org.apache.shiro.realm.AuthorizingRealm#setName(java.lang.String)
61
	 */
62
	@Override
63
	public void setName(String name) {
64
		this.name = name;
65
	}
66
 
67
 
68
	/**
69
	 * Instantiates a new x services realm with default
70
	 * 'shiro.ini' in classpath and {@link net.brutex.xservices.security.PermissionResolver PermissionResolver}.
71
	 *
72
	 */
73
	public XServicesRealm() {
74
		super();
75
		this.setIni(Ini.fromResourcePath(ResourceUtils.CLASSPATH_PREFIX+"shiro.ini"));
76
		this.setPermissionResolver(new net.brutex.xservices.security.PermissionResolver());
77
		//this.setRolePermissionResolver(new RolePermissionResolver());
78
		init();
79
	}
80
}