blob: 5793daefc3186b0276fc1c4b9c6884d9534184b3 [file] [log] [blame]
Shuyi Chend7955ce2013-05-22 14:51:55 -07001/*
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 */
21package org.apache.qpid.management.common.sasl;
22
23import org.apache.harmony.javax.security.sasl.SaslClientFactory;
24import java.security.Provider;
25import java.util.Map;
26
27public class JCAProvider extends Provider
28{
29 private static final long serialVersionUID = 1L;
30
31 /**
32 * Creates the security provider with a map from SASL mechanisms to implementing factories.
33 *
34 * @param providerMap The map from SASL mechanims to implementing factory classes.
35 */
36 public JCAProvider(Map<String, Class<? extends SaslClientFactory>> providerMap)
37 {
38 super("AMQSASLProvider", 1.0, "A JCA provider that registers all "
39 + "AMQ SASL providers that want to be registered");
40 register(providerMap);
41 }
42
43 /**
44 * Registers client factory classes for a map of mechanism names to client factory classes.
45 *
46 * @param providerMap The map from SASL mechanims to implementing factory classes.
47 */
48 private void register(Map<String, Class<? extends SaslClientFactory>> providerMap)
49 {
50 for (Map.Entry<String, Class<? extends SaslClientFactory>> me : providerMap.entrySet())
51 {
52 put("SaslClientFactory." + me.getKey(), me.getValue().getName());
53 }
54 }
55}