All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.eshore.uas.system.AuthConfig Maven / Gradle / Ivy

There is a newer version: 2.0.3
Show newest version
package com.eshore.uas.system;

import java.util.HashMap;

import com.eshore.khala.utils.LRUCache;
import com.eshore.uas.server.api.UserAuth;
import com.eshore.uas.server.api.UserProvider;

public class AuthConfig {
	static LRUCache authMethods = new LRUCache();
	static LRUCache userProviders = new LRUCache();
	static DefaultUserProviderFactory upf = new DefaultUserProviderFactory();
	
	//static LRUCache userProviders = new LRUCache();
	
	public static void registry(UserProvider prov,String domain) {
		userProviders.put(domain, prov,0);
		authMethods.put(domain,new DefaultUserAuth(prov));
		
	}
	
	public static void registry(UserAuth prov,String domain) {
		authMethods.put(domain, prov,0);
	}
	
	public static UserAuth getUserAuth(String domain) {
		UserAuth ua = authMethods.get(domain);
		if(ua!=null)return ua;
		UserProvider up= upf.getUserProvider(domain);
		return authMethods.get(domain);
	}
	
	public static UserProvider getUserProvider(String domain) {
		return userProviders.get(domain);
	}
	
	public static UserProvider  registryEmputy(String domain) {
		//UserProvider p =new EmptyUserProvider();
		userProviders.put(domain, null);
		//authMethods.put(domain,null);
		return null;
	}
	
	public static boolean hasProvider(String domain) {
		return userProviders.containsKey(domain);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy