]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.security.core/src/org/argeo/security/core/AuthenticationProvidersRegister.java
Improve login
[lgpl/argeo-commons.git] / org.argeo.security.core / src / org / argeo / security / core / AuthenticationProvidersRegister.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
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 package org.argeo.security.core;
17
18 import java.util.ArrayList;
19 import java.util.List;
20 import java.util.Map;
21
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;
24 import org.springframework.beans.factory.InitializingBean;
25
26 /**
27 * Maintains a list of authentication providers injected in to a provider
28 * manager, in order to avoid issues with OSGi services and use packages.
29 */
30 @Deprecated
31 public class AuthenticationProvidersRegister implements InitializingBean {
32 private Log log = LogFactory.getLog(AuthenticationProvidersRegister.class);
33
34 private List<Object> providers = new ArrayList<Object>();
35 private List<Object> defaultProviders = new ArrayList<Object>();
36
37 public void register(Object authenticationProvider,
38 Map<String, String> parameters) {
39 providers.add(authenticationProvider);
40 if (log.isTraceEnabled())
41 log.trace("Registered authentication provider " + parameters);
42 }
43
44 public void unregister(Object authenticationProvider,
45 Map<String, String> parameters) {
46 providers.remove(authenticationProvider);
47 if (log.isTraceEnabled())
48 log.trace("Unregistered authentication provider " + parameters);
49 }
50
51 public List<Object> getProviders() {
52 return providers;
53 }
54
55 public void setDefaultProviders(
56 List<Object> defaultProviders) {
57 this.defaultProviders = defaultProviders;
58 }
59
60 public void afterPropertiesSet() throws Exception {
61 providers.addAll(defaultProviders);
62 }
63
64 }