1 // ======================================================================== 2 // Copyright (c) 2006-2009 Mort Bay Consulting Pty. Ltd. 3 // ------------------------------------------------------------------------ 4 // All rights reserved. This program and the accompanying materials 5 // are made available under the terms of the Eclipse Public License v1.0 6 // and Apache License v2.0 which accompanies this distribution. 7 // The Eclipse Public License is available at 8 // http://www.eclipse.org/legal/epl-v10.html 9 // The Apache License v2.0 is available at 10 // http://www.opensource.org/licenses/apache2.0.php 11 // You may elect to redistribute this code under either of these licenses. 12 // ======================================================================== 13 14 package org.eclipse.jetty.client.security; 15 16 import java.io.IOException; 17 import java.util.HashMap; 18 import java.util.Map; 19 20 import org.eclipse.jetty.client.HttpDestination; 21 22 public class HashRealmResolver implements RealmResolver 23 { 24 private Map<String, Realm>_realmMap; 25 26 public void addSecurityRealm( Realm realm ) 27 { 28 if (_realmMap == null) 29 { 30 _realmMap = new HashMap<String, Realm>(); 31 } 32 _realmMap.put( realm.getId(), realm ); 33 } 34 35 public Realm getRealm( String realmName, HttpDestination destination, String path ) throws IOException 36 { 37 return _realmMap.get( realmName ); 38 } 39 40 }