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.
30 public class AuthenticationProvidersRegister
implements InitializingBean
{
31 private Log log
= LogFactory
.getLog(AuthenticationProvidersRegister
.class);
33 private List
<Object
> providers
= new ArrayList
<Object
>();
34 private List
<Object
> defaultProviders
= new ArrayList
<Object
>();
36 public void register(Object authenticationProvider
,
37 Map
<String
, String
> parameters
) {
38 providers
.add(authenticationProvider
);
39 if (log
.isTraceEnabled())
40 log
.trace("Registered authentication provider " + parameters
);
43 public void unregister(Object authenticationProvider
,
44 Map
<String
, String
> parameters
) {
45 providers
.remove(authenticationProvider
);
46 if (log
.isTraceEnabled())
47 log
.trace("Unregistered authentication provider " + parameters
);
50 public List
<Object
> getProviders() {
54 public void setDefaultProviders(
55 List
<Object
> defaultProviders
) {
56 this.defaultProviders
= defaultProviders
;
59 public void afterPropertiesSet() throws Exception
{
60 providers
.addAll(defaultProviders
);