public String buildPasswordResetUrl ( final String username , final PasswordManagementService passwordManagementService , final CasConfigurationProperties casProperties ) { val token = passwordManagementService . createToken ( username ) ; if ( StringUtils . isNotBlank ( token ) ) { val transientFactory = ( TransientSessionTicketFactory ) this . ticketFactory . get ( TransientSessionTicket . class ) ; val serverPrefix = casProperties . getServer ( ) . getPrefix ( ) ; val service = webApplicationServiceFactory . createService ( serverPrefix ) ; val properties = CollectionUtils . < String , Serializable > wrap ( PasswordManagementWebflowUtils . FLOWSCOPE_PARAMETER_NAME_TOKEN , token ) ; val ticket = transientFactory . create ( service , properties ) ; this . ticketRegistry . addTicket ( ticket ) ; return serverPrefix . concat ( ' ' + CasWebflowConfigurer . FLOW_ID_LOGIN + ' ' + PasswordManagementWebflowUtils . REQUEST_PARAMETER_NAME_PASSWORD_RESET_TOKEN + ' ' ) . concat ( ticket . getId ( ) ) ; } LOGGER . error ( "Could not create password reset url since no reset token could be generated" ) ; return null ; }
Utility method to generate a password reset URL .