2 * Copyright (C) 2007-2012 Argeo GmbH
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org
.argeo
.security
.core
;
18 import java
.util
.ArrayList
;
19 import java
.util
.List
;
22 import org
.apache
.commons
.logging
.Log
;
23 import org
.apache
.commons
.logging
.LogFactory
;
24 import org
.springframework
.beans
.factory
.InitializingBean
;
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.
31 public class AuthenticationProvidersRegister
implements InitializingBean
{
32 private Log log
= LogFactory
.getLog(AuthenticationProvidersRegister
.class);
34 private List
<Object
> providers
= new ArrayList
<Object
>();
35 private List
<Object
> defaultProviders
= new ArrayList
<Object
>();
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
);
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
);
51 public List
<Object
> getProviders() {
55 public void setDefaultProviders(
56 List
<Object
> defaultProviders
) {
57 this.defaultProviders
= defaultProviders
;
60 public void afterPropertiesSet() throws Exception
{
61 providers
.addAll(defaultProviders
);