01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.openejb.spi;
17:
18: import org.apache.openejb.InterfaceType;
19:
20: import javax.security.auth.login.LoginException;
21: import java.lang.reflect.Method;
22: import java.security.Principal;
23:
24: /**
25: * The generic value T is any serializable token of the SecurityService
26: * implementations choosing. This token only needs to be understandable
27: * by the SecurityService internally and need not be a publicly usable class
28: * type. No part of the outlying system will make any assumptions as to the
29: * type of the object. The use of a java generic type is to express the
30: * required symmetry in the interface.
31: *
32: */
33: public interface SecurityService<T> extends Service {
34: /**
35: *
36: */
37: public T login(String user, String pass) throws LoginException;
38:
39: public T login(String securityRealm, String user, String pass)
40: throws LoginException;
41:
42: /**
43: * Active
44: */
45: public void associate(T securityIdentity) throws LoginException;
46:
47: /**
48: * Active
49: */
50: public T disassociate();
51:
52: /**
53: * Active
54: */
55: public void logout(T securityIdentity) throws LoginException;
56:
57: /**
58: * Active
59: */
60: public boolean isCallerInRole(String role);
61:
62: /**
63: * Active
64: */
65: public Principal getCallerPrincipal();
66:
67: /**
68: * Active
69: */
70: public boolean isCallerAuthorized(Method method, InterfaceType type);
71:
72: }
|