X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2Finternal%2Fauth%2FAnonymousLoginModule.java;h=855524961c86e390fe14b742e90c53ce95362c86;hb=e91af5c65a42b3ff98400caa552965cdb3f730e6;hp=372f27e60bc0205ff54d77c8cc729b4430e2bf4d;hpb=d12f4cda6ff7b1de242a19362c3680f30ccc5168;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms/src/org/argeo/cms/internal/auth/AnonymousLoginModule.java b/org.argeo.cms/src/org/argeo/cms/internal/auth/AnonymousLoginModule.java index 372f27e60..855524961 100644 --- a/org.argeo.cms/src/org/argeo/cms/internal/auth/AnonymousLoginModule.java +++ b/org.argeo.cms/src/org/argeo/cms/internal/auth/AnonymousLoginModule.java @@ -43,19 +43,22 @@ public class AnonymousLoginModule extends AbstractLoginModule { InterruptedException { Locale selectedLocale = null; // multi locale - if (availableLocales != null && !availableLocales.trim().equals("")) { - LocaleCallback localeCallback = new LocaleCallback(availableLocales); - callbackHandler.handle(new Callback[] { localeCallback }); - selectedLocale = localeCallback.getSelectedLocale(); - } else { - callbackHandler.handle(new Callback[] {}); - } + if (callbackHandler != null) + if (availableLocales != null && !availableLocales.trim().equals("")) { + LocaleCallback localeCallback = new LocaleCallback( + availableLocales); + callbackHandler.handle(new Callback[] { localeCallback }); + selectedLocale = localeCallback.getSelectedLocale(); + } else { + callbackHandler.handle(new Callback[] {}); + } List authorities = Collections .singletonList(new GrantedAuthorityPrincipal( KernelHeader.ROLE_ANONYMOUS)); AnonymousAuthenticationToken anonymousToken = new AnonymousAuthenticationToken( - Activator.getSystemKey(), null, authorities); + Activator.getSystemKey(), KernelHeader.USERNAME_ANONYMOUS, + authorities); Authentication auth = getAuthenticationManager().authenticate( anonymousToken);