public void setUsername(String username) { if (this.username != username && (this.username == null || !this.username.equals(username))) { this.username = username; invalid = false; if (Events.exists()) Events.instance().raiseEvent(EVENT_CREDENTIALS_UPDATED); } }
public void setPassword(String password) { if (this.password != password && (this.password == null || !this.password.equals(password))) { this.password = password; invalid = false; if (Events.exists()) Events.instance().raiseEvent(EVENT_CREDENTIALS_UPDATED); } }
/** * Clears any roles added by calling addRole() while not authenticated. * This method may be overridden by a subclass if different * pre-authentication logic should occur. */ protected void preAuthenticate() { preAuthenticationRoles.clear(); if (Events.exists()) Events.instance().raiseEvent(EVENT_PRE_AUTHENTICATE); }
public void set(String name, Object value) { // We can't raise a preSetVariable event for Events itself because it doesn't exist yet... if ( !Seam.getComponentName(Events.class).equals(name) && Events.exists() ) { Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name); } map.put(name, value); if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.postSetVariable." + name); }
protected void raiseEvent(String eventName, Object... params) { if (Events.exists()) { Events.instance().raiseEvent(eventName, params); } }
public void set(String name, Object value) { if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name); if (value==null) { //yes, we need this remove(name); } else { removals.remove(name); additions.put(name, value); } if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.postSetVariable." + name); }
public String getUsername() { if (!isInitialized() && Events.exists()) { setInitialized(true); Events.instance().raiseEvent(EVENT_INIT_CREDENTIALS, this); } return username; }
/** * Force the resource bundle to reload, using the current locale, * and raise the org.jboss.seam.timeZoneSelected event */ public void select() { setCookieValueIfEnabled( getTimeZoneId() ); if ( Events.exists() ) { Events.instance().raiseEvent( "org.jboss.seam.timeZoneSelected", getTimeZoneId() ); } }
/** * Force the resource bundle to reload, using the current locale, * and raise the org.jboss.seam.localeSelected event. */ public void select() { FacesContext.getCurrentInstance().getViewRoot().setLocale( getLocale() ); //Contexts.removeFromAllContexts("org.jboss.seam.core.resourceBundle"); Contexts.removeFromAllContexts("org.jboss.seam.international.messages"); setCookieValueIfEnabled( getLocaleString() ); if ( Events.exists() ) { Events.instance().raiseEvent( "org.jboss.seam.localeSelected", getLocaleString() ); } }
/** * Raise an event so that an observer may add a faces message when Seam-managed transactions fail. */ protected void raiseTransactionFailedEvent() { try { UserTransaction tx = Transaction.instance(); if ( tx.isRolledBackOrMarkedRollback() ) { if (Events.exists()) Events.instance().raiseEvent(TRANSACTION_FAILED, tx.getStatus()); } } catch (Exception e) {} //swallow silently, not important }
public void logout() { if (isLoggedIn()) { unAuthenticate(); Session.instance().invalidate(); if (Events.exists()) Events.instance().raiseEvent(EVENT_LOGGED_OUT); } }
public void sendAuthenticationRequestToIDP(HttpServletRequest request, HttpServletResponse response, SamlIdentityProvider samlIdentityProvider, String returnUrl) { AuthnRequestType authnRequest = samlMessageFactory.createAuthnRequest(); requests.addRequest(authnRequest.getID(), samlIdentityProvider, returnUrl); if (Events.exists()) { Events.instance().raiseEvent(Identity.EVENT_PRE_AUTHENTICATE); } samlMessageSender.sendRequestToIDP(request, response, samlIdentityProvider, SamlProfile.SINGLE_SIGN_ON, authnRequest); } }
/** * Promote a temporary conversation and make it long-running */ public void beginConversation() { if ( !isLongRunningConversation() ) { log.debug("Beginning long-running conversation"); setLongRunningConversation(true); createConversationEntry(); Conversation.instance(); //force instantiation of the Conversation in the outer (non-nested) conversation storeConversationToViewRootIfNecessary(); if ( Events.exists() ) Events.instance().raiseEvent(EVENT_CONVERSATION_BEGIN); } }
private ResolverChain createDefaultResolverChain() { ResolverChain chain = (ResolverChain) Contexts.getSessionContext().get(DEFAULT_RESOLVER_CHAIN); if (chain == null) { chain = new ResolverChain(); for (String resolverName : Init.instance().getPermissionResolvers()) { chain.getResolvers().add((PermissionResolver) Component.getInstance(resolverName, true)); } Contexts.getSessionContext().set(DEFAULT_RESOLVER_CHAIN, chain); if (Events.exists()) Events.instance().raiseEvent(DEFAULT_RESOLVER_CHAIN_CREATED, chain); } return chain; }
/** * Make a long-running conversation temporary. */ public void endConversation(boolean beforeRedirect) { if ( isLongRunningConversation() ) { log.debug("Ending long-running conversation"); if ( Events.exists() ) Events.instance().raiseEvent(EVENT_CONVERSATION_END); setLongRunningConversation(false); destroyBeforeRedirect = beforeRedirect; endNestedConversations( getCurrentConversationId() ); storeConversationToViewRootIfNecessary(); } unlockConversation(); }