Muito boa sua pergunta…
eu não achei nada na net, acho que vou ter que ler a documentação novamente, mais da pra fazer “um gato”…
o ponto e que as regras não são carregadas em tempo de execução, e sim em tempo de inicialização por isso que você tem que reiniciar o tomcat…
Não sei se e a melhor solução… mais;…
como nunca fiz isso, podemos começar tentando por esse cara:
ProviderManager
public Authentication doAuthentication(Authentication authentication)
200: throws AuthenticationException {
201: Iterator iter = providers.iterator();
202:
203: Class toTest = authentication.getClass();
204:
205: AuthenticationException lastException = null;
206:
207: while (iter.hasNext()) {
208: AuthenticationProvider provider = (AuthenticationProvider) iter
209: .next();
210:
211: if (provider.supports(toTest)) {
212: logger.debug("Authentication attempt using "
213: + provider.getClass().getName());
214:
215: Authentication result = null;
216:
217: try {
218: [b]result = provider.authenticate(authentication);[/b]
219: sessionController
220: .checkAuthenticationAllowed(result);
221: } catch (AuthenticationException ae) {
222: lastException = ae;
223: result = null;
224: }
225:
226: if (result != null) {
227: sessionController
228: .registerSuccessfulAuthentication(result);
229: publishEvent(new AuthenticationSuccessEvent(result));
230:
231: return result;
232: }
233: }
234: }
235:
236: if (lastException == null) {
237: lastException = new ProviderNotFoundException(messages
238: .getMessage("ProviderManager.providerNotFound",
239: new Object[] { toTest.getName() },
240: "No AuthenticationProvider found for {0}"));
241: }
242:
243: // Publish the event
244: String className = exceptionMappings.getProperty(lastException
245: .getClass().getName());
246: AbstractAuthenticationEvent event = null;
247:
248: if (className != null) {
249: try {
250: Class clazz = getClass().getClassLoader().loadClass(
251: className);
252: Constructor constructor = clazz
253: .getConstructor(new Class[] {
254: Authentication.class,
255: AuthenticationException.class });
256: Object obj = constructor.newInstance(new Object[] {
257: authentication, lastException });
258: Assert.isInstanceOf(AbstractAuthenticationEvent.class,
259: obj, "Must be an AbstractAuthenticationEvent");
260: event = (AbstractAuthenticationEvent) obj;
261: } catch (ClassNotFoundException ignored) {
262: } catch (NoSuchMethodException ignored) {
263: } catch (IllegalAccessException ignored) {
264: } catch (InstantiationException ignored) {
265: } catch (InvocationTargetException ignored) {
266: }
267: }
268:
269: if (event != null) {
270: publishEvent(event);
271: } else {
272: if (logger.isDebugEnabled()) {
273: logger.debug("No event was found for the exception "
274: + lastException.getClass().getName());
275: }
276: }
277:
278: // Throw the exception
279: throw lastException;
280: }
281:
o metodo provider.authenticate
e quem acessa a Classe InMemory e pega os usuários em memoria…
Logo devemos reescrever InMemory para buscar os usuário do DAO sempre…
mais uma vez, não sei se e a melhor solução e acabei de pensar nela agora, eu não vi a documentação direito…
mais deve funcionar…
de qualquer forma vou procurar coisa melhor e te falo.
abs