Class SendPasswordResetInstructionsAction

  • All Implemented Interfaces:
    org.springframework.beans.factory.InitializingBean, org.springframework.webflow.execution.Action

    public class SendPasswordResetInstructionsAction
    extends org.apereo.cas.web.flow.actions.BaseCasWebflowAction
    Since:
    5.0.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apereo.cas.configuration.CasConfigurationProperties casProperties
      The CAS configuration properties.
      protected org.apereo.cas.notifications.CommunicationsManager communicationsManager
      The communication manager for SMS/emails.
      protected org.apereo.cas.pm.PasswordManagementService passwordManagementService
      The password management service.
      protected org.apereo.cas.pm.PasswordResetUrlBuilder passwordResetUrlBuilder
      Build the reset URL for the user.
      protected org.apereo.cas.authentication.principal.PrincipalResolver principalResolver
      The principal resolver to resolve the user and fetch attributes for follow-up ops, such as email message body building.
      static java.lang.String REQUEST_PARAMETER_USERNAME
      Parameter name to look up the user.
      protected org.apereo.cas.ticket.TicketFactory ticketFactory
      Ticket factory instance.
      protected org.apereo.cas.ticket.registry.TicketRegistry ticketRegistry
      Ticket registry instance to hold onto the token.
      • Fields inherited from class org.springframework.webflow.action.AbstractAction

        logger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.apereo.cas.pm.PasswordManagementQuery buildPasswordManagementQuery​(org.springframework.webflow.execution.RequestContext requestContext)  
      protected java.net.URL buildPasswordResetUrl​(java.lang.String username, org.apereo.cas.authentication.principal.WebApplicationService service)
      Utility method to generate a password reset URL.
      protected org.springframework.webflow.execution.Event doExecute​(org.springframework.webflow.execution.RequestContext requestContext)  
      protected org.springframework.webflow.execution.Event getErrorEvent​(java.lang.String code, java.lang.String defaultMessage, org.springframework.webflow.execution.RequestContext requestContext)
      Gets error event.
      protected org.springframework.webflow.execution.Event getInvalidContactEvent​(org.springframework.webflow.execution.RequestContext requestContext)
      Get the "invalid contact" event.
      protected org.apereo.cas.notifications.mail.EmailCommunicationResult sendPasswordResetEmailToAccount​(java.lang.String username, java.lang.String to, java.net.URL url, org.springframework.webflow.execution.RequestContext requestContext)  
      protected boolean sendPasswordResetSmsToAccount​(java.lang.String to, java.net.URL url)  
      • Methods inherited from class org.apereo.cas.web.flow.actions.BaseCasWebflowAction

        isLoginFlowActive
      • Methods inherited from class org.springframework.webflow.action.AbstractAction

        afterPropertiesSet, doPostExecute, doPreExecute, error, error, execute, getActionNameForLogging, getEventFactorySupport, initAction, no, result, result, result, result, success, success, yes
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • REQUEST_PARAMETER_USERNAME

        public static final java.lang.String REQUEST_PARAMETER_USERNAME
        Parameter name to look up the user.
        See Also:
        Constant Field Values
      • casProperties

        protected final org.apereo.cas.configuration.CasConfigurationProperties casProperties
        The CAS configuration properties.
      • communicationsManager

        protected final org.apereo.cas.notifications.CommunicationsManager communicationsManager
        The communication manager for SMS/emails.
      • passwordManagementService

        protected final org.apereo.cas.pm.PasswordManagementService passwordManagementService
        The password management service.
      • ticketRegistry

        protected final org.apereo.cas.ticket.registry.TicketRegistry ticketRegistry
        Ticket registry instance to hold onto the token.
      • ticketFactory

        protected final org.apereo.cas.ticket.TicketFactory ticketFactory
        Ticket factory instance.
      • principalResolver

        protected final org.apereo.cas.authentication.principal.PrincipalResolver principalResolver
        The principal resolver to resolve the user and fetch attributes for follow-up ops, such as email message body building.
      • passwordResetUrlBuilder

        protected final org.apereo.cas.pm.PasswordResetUrlBuilder passwordResetUrlBuilder
        Build the reset URL for the user.
    • Constructor Detail

      • SendPasswordResetInstructionsAction

        public SendPasswordResetInstructionsAction()
    • Method Detail

      • buildPasswordResetUrl

        protected java.net.URL buildPasswordResetUrl​(java.lang.String username,
                                                     org.apereo.cas.authentication.principal.WebApplicationService service)
                                              throws java.lang.Exception
        Utility method to generate a password reset URL.
        Parameters:
        username - username
        service - service from the flow scope
        Returns:
        URL a user can use to start the password reset process
        Throws:
        java.lang.Exception - the exception
      • doExecute

        protected org.springframework.webflow.execution.Event doExecute​(org.springframework.webflow.execution.RequestContext requestContext)
                                                                 throws java.lang.Exception
        Specified by:
        doExecute in class org.springframework.webflow.action.AbstractAction
        Throws:
        java.lang.Exception
      • buildPasswordManagementQuery

        protected org.apereo.cas.pm.PasswordManagementQuery buildPasswordManagementQuery​(org.springframework.webflow.execution.RequestContext requestContext)
      • getInvalidContactEvent

        protected org.springframework.webflow.execution.Event getInvalidContactEvent​(org.springframework.webflow.execution.RequestContext requestContext)
        Get the "invalid contact" event. It could be overriden to return success and hide the fact that the login does not exist.
        Parameters:
        requestContext - the request context
        Returns:
        the event
      • sendPasswordResetSmsToAccount

        protected boolean sendPasswordResetSmsToAccount​(java.lang.String to,
                                                        java.net.URL url)
      • sendPasswordResetEmailToAccount

        protected org.apereo.cas.notifications.mail.EmailCommunicationResult sendPasswordResetEmailToAccount​(java.lang.String username,
                                                                                                             java.lang.String to,
                                                                                                             java.net.URL url,
                                                                                                             org.springframework.webflow.execution.RequestContext requestContext)
      • getErrorEvent

        protected org.springframework.webflow.execution.Event getErrorEvent​(java.lang.String code,
                                                                            java.lang.String defaultMessage,
                                                                            org.springframework.webflow.execution.RequestContext requestContext)
        Gets error event.
        Parameters:
        code - the code
        defaultMessage - the default message
        requestContext - the request context
        Returns:
        the error event