Usando la primavera, ¿cómo puedo disparar manualmente autenticationsuccesshandler -- java campo con spring campo con spring-mvc camp Relacionados El problema

Using Spring, how can I manually fire AuthenticationSuccessHandler


2
vote

problema

Español

Quiero proporcionar al usuario un medio alternativo para iniciar sesión con un token. Ya manejo la autenticación del usuario en la clase de preauthenticationFilter, pero entonces necesito despedir mi

#include "Runway.h" #include <iostream> using namespace std; Runway::Runway(int limit) /* Post: The Runway data members are initialized to record no prior Runway use and to record the limit on queue sizes. */ { queue_limit = limit; num_land_requests = num_takeoff_requests = 0; num_landings = num_takeoffs = 0; num_land_refused = num_takeoff_refused = 0; num_land_accepted = num_takeoff_accepted = 0; land_wait = takeoff_wait = idle_time = 0; } Error_code Runway::can_land(const Plane& current) /* Post: If possible, the Plane current is added to the landing Queue; otherwise, an Error_code of overflow is returned. The Runway statistics are updated. Uses: class Extended_queue. */ { Error_code result; if (landing.size() < queue_limit) result = landing.append(current); else result = fail; num_land_requests++; if (result != success) num_land_refused++; else num_land_accepted++; return result; } Error_code Runway::can_depart(const Plane& current) /* Post: If possible, the Plane current is added to the takeoff Queue; otherwise, an Error_code of overflow is returned. The Runway statistics are updated. Uses: class Extended_queue. */ { Error_code result; if (takeoff.size() < queue_limit) result = takeoff.append(current); else result = fail; num_takeoff_requests++; if (result != success) num_takeoff_refused++; else num_takeoff_accepted++; return result; } Runway_activity Runway::activity(int time, Plane& moving) /* Post: If the landing Queue has entries, its front Plane is copied to the parameter moving and a result land is returned. Otherwise, if the takeoff Queue has entries, its front Plane is copied to the parameter moving and a result takeoff is returned. Otherwise, idle is returned. Runway statistics are updated. Uses: class Extended_queue. */ { Runway_activity in_progress; if (!landing.empty()) { landing.retrieve(moving); land_wait += time - moving.started(); num_landings++; in_progress = land; landing.serve(); } else if (!takeoff.empty()) { takeoff.retrieve(moving); takeoff_wait += time - moving.started(); num_takeoffs++; in_progress = takeoff; takeoff.serve(); } else { idle_time++; in_progress = idle; } return in_progress; } void Runway::shut_down(int time) const /* Post: Runway usage statistics are summarized and printed. */ { cout << "Simulation has concluded after " << time << " time units." << endl << "Total number of planes processed " << (num_land_requests + num_takeoff_requests) << endl << "Total number of planes asking to land " << num_land_requests << endl << "Total number of planes asking to take off " << num_takeoff_requests << endl << "Total number of planes accepted for landing " << num_land_accepted << endl << "Total number of planes accepted for takeoff " << num_takeoff_accepted << endl << "Total number of planes refused for landing " << num_land_refused << endl << "Total number of planes refused for takeoff " << num_takeoff_refused << endl << "Total number of planes that landed " << num_landings << endl << "Total number of planes that took off " << num_takeoffs << endl << "Total number of planes left in landing queue " << landing.size() << endl << "Total number of planes left in takeoff queue " << takeoff.size() << endl; cout << "Percentage of time runway idle " << 100.0 * ((float)idle_time) / ((float)time) << "%" << endl; cout << "Average wait in landing queue " << ((float)land_wait) / ((float)num_landings) << " time units"; cout << endl << "Average wait in takeoff queue " << ((float)takeoff_wait) / ((float)num_takeoffs) << " time units" << endl; cout << "Average observed rate of planes wanting to land " << ((float)num_land_requests) / ((float)time) << " per time unit" << endl; cout << "Average observed rate of planes wanting to take off " << ((float)num_takeoff_requests) / ((float)time) << " per time unit" << endl; } 111

que hace un

#include "Runway.h" #include <iostream> using namespace std; Runway::Runway(int limit) /* Post: The Runway data members are initialized to record no prior Runway use and to record the limit on queue sizes. */ { queue_limit = limit; num_land_requests = num_takeoff_requests = 0; num_landings = num_takeoffs = 0; num_land_refused = num_takeoff_refused = 0; num_land_accepted = num_takeoff_accepted = 0; land_wait = takeoff_wait = idle_time = 0; } Error_code Runway::can_land(const Plane& current) /* Post: If possible, the Plane current is added to the landing Queue; otherwise, an Error_code of overflow is returned. The Runway statistics are updated. Uses: class Extended_queue. */ { Error_code result; if (landing.size() < queue_limit) result = landing.append(current); else result = fail; num_land_requests++; if (result != success) num_land_refused++; else num_land_accepted++; return result; } Error_code Runway::can_depart(const Plane& current) /* Post: If possible, the Plane current is added to the takeoff Queue; otherwise, an Error_code of overflow is returned. The Runway statistics are updated. Uses: class Extended_queue. */ { Error_code result; if (takeoff.size() < queue_limit) result = takeoff.append(current); else result = fail; num_takeoff_requests++; if (result != success) num_takeoff_refused++; else num_takeoff_accepted++; return result; } Runway_activity Runway::activity(int time, Plane& moving) /* Post: If the landing Queue has entries, its front Plane is copied to the parameter moving and a result land is returned. Otherwise, if the takeoff Queue has entries, its front Plane is copied to the parameter moving and a result takeoff is returned. Otherwise, idle is returned. Runway statistics are updated. Uses: class Extended_queue. */ { Runway_activity in_progress; if (!landing.empty()) { landing.retrieve(moving); land_wait += time - moving.started(); num_landings++; in_progress = land; landing.serve(); } else if (!takeoff.empty()) { takeoff.retrieve(moving); takeoff_wait += time - moving.started(); num_takeoffs++; in_progress = takeoff; takeoff.serve(); } else { idle_time++; in_progress = idle; } return in_progress; } void Runway::shut_down(int time) const /* Post: Runway usage statistics are summarized and printed. */ { cout << "Simulation has concluded after " << time << " time units." << endl << "Total number of planes processed " << (num_land_requests + num_takeoff_requests) << endl << "Total number of planes asking to land " << num_land_requests << endl << "Total number of planes asking to take off " << num_takeoff_requests << endl << "Total number of planes accepted for landing " << num_land_accepted << endl << "Total number of planes accepted for takeoff " << num_takeoff_accepted << endl << "Total number of planes refused for landing " << num_land_refused << endl << "Total number of planes refused for takeoff " << num_takeoff_refused << endl << "Total number of planes that landed " << num_landings << endl << "Total number of planes that took off " << num_takeoffs << endl << "Total number of planes left in landing queue " << landing.size() << endl << "Total number of planes left in takeoff queue " << takeoff.size() << endl; cout << "Percentage of time runway idle " << 100.0 * ((float)idle_time) / ((float)time) << "%" << endl; cout << "Average wait in landing queue " << ((float)land_wait) / ((float)num_landings) << " time units"; cout << endl << "Average wait in takeoff queue " << ((float)takeoff_wait) / ((float)num_takeoffs) << " time units" << endl; cout << "Average observed rate of planes wanting to land " << ((float)num_land_requests) / ((float)time) << " per time unit" << endl; cout << "Average observed rate of planes wanting to take off " << ((float)num_takeoff_requests) / ((float)time) << " per time unit" << endl; } 2

que incendia el método en su clase base de

#include "Runway.h" #include <iostream> using namespace std; Runway::Runway(int limit) /* Post: The Runway data members are initialized to record no prior Runway use and to record the limit on queue sizes. */ { queue_limit = limit; num_land_requests = num_takeoff_requests = 0; num_landings = num_takeoffs = 0; num_land_refused = num_takeoff_refused = 0; num_land_accepted = num_takeoff_accepted = 0; land_wait = takeoff_wait = idle_time = 0; } Error_code Runway::can_land(const Plane& current) /* Post: If possible, the Plane current is added to the landing Queue; otherwise, an Error_code of overflow is returned. The Runway statistics are updated. Uses: class Extended_queue. */ { Error_code result; if (landing.size() < queue_limit) result = landing.append(current); else result = fail; num_land_requests++; if (result != success) num_land_refused++; else num_land_accepted++; return result; } Error_code Runway::can_depart(const Plane& current) /* Post: If possible, the Plane current is added to the takeoff Queue; otherwise, an Error_code of overflow is returned. The Runway statistics are updated. Uses: class Extended_queue. */ { Error_code result; if (takeoff.size() < queue_limit) result = takeoff.append(current); else result = fail; num_takeoff_requests++; if (result != success) num_takeoff_refused++; else num_takeoff_accepted++; return result; } Runway_activity Runway::activity(int time, Plane& moving) /* Post: If the landing Queue has entries, its front Plane is copied to the parameter moving and a result land is returned. Otherwise, if the takeoff Queue has entries, its front Plane is copied to the parameter moving and a result takeoff is returned. Otherwise, idle is returned. Runway statistics are updated. Uses: class Extended_queue. */ { Runway_activity in_progress; if (!landing.empty()) { landing.retrieve(moving); land_wait += time - moving.started(); num_landings++; in_progress = land; landing.serve(); } else if (!takeoff.empty()) { takeoff.retrieve(moving); takeoff_wait += time - moving.started(); num_takeoffs++; in_progress = takeoff; takeoff.serve(); } else { idle_time++; in_progress = idle; } return in_progress; } void Runway::shut_down(int time) const /* Post: Runway usage statistics are summarized and printed. */ { cout << "Simulation has concluded after " << time << " time units." << endl << "Total number of planes processed " << (num_land_requests + num_takeoff_requests) << endl << "Total number of planes asking to land " << num_land_requests << endl << "Total number of planes asking to take off " << num_takeoff_requests << endl << "Total number of planes accepted for landing " << num_land_accepted << endl << "Total number of planes accepted for takeoff " << num_takeoff_accepted << endl << "Total number of planes refused for landing " << num_land_refused << endl << "Total number of planes refused for takeoff " << num_takeoff_refused << endl << "Total number of planes that landed " << num_landings << endl << "Total number of planes that took off " << num_takeoffs << endl << "Total number of planes left in landing queue " << landing.size() << endl << "Total number of planes left in takeoff queue " << takeoff.size() << endl; cout << "Percentage of time runway idle " << 100.0 * ((float)idle_time) / ((float)time) << "%" << endl; cout << "Average wait in landing queue " << ((float)land_wait) / ((float)num_landings) << " time units"; cout << endl << "Average wait in takeoff queue " << ((float)takeoff_wait) / ((float)num_takeoffs) << " time units" << endl; cout << "Average observed rate of planes wanting to land " << ((float)num_land_requests) / ((float)time) << " per time unit" << endl; cout << "Average observed rate of planes wanting to take off " << ((float)num_takeoff_requests) / ((float)time) << " per time unit" << endl; } 3

¿Cómo puedo despedir el #include "Runway.h" #include <iostream> using namespace std; Runway::Runway(int limit) /* Post: The Runway data members are initialized to record no prior Runway use and to record the limit on queue sizes. */ { queue_limit = limit; num_land_requests = num_takeoff_requests = 0; num_landings = num_takeoffs = 0; num_land_refused = num_takeoff_refused = 0; num_land_accepted = num_takeoff_accepted = 0; land_wait = takeoff_wait = idle_time = 0; } Error_code Runway::can_land(const Plane& current) /* Post: If possible, the Plane current is added to the landing Queue; otherwise, an Error_code of overflow is returned. The Runway statistics are updated. Uses: class Extended_queue. */ { Error_code result; if (landing.size() < queue_limit) result = landing.append(current); else result = fail; num_land_requests++; if (result != success) num_land_refused++; else num_land_accepted++; return result; } Error_code Runway::can_depart(const Plane& current) /* Post: If possible, the Plane current is added to the takeoff Queue; otherwise, an Error_code of overflow is returned. The Runway statistics are updated. Uses: class Extended_queue. */ { Error_code result; if (takeoff.size() < queue_limit) result = takeoff.append(current); else result = fail; num_takeoff_requests++; if (result != success) num_takeoff_refused++; else num_takeoff_accepted++; return result; } Runway_activity Runway::activity(int time, Plane& moving) /* Post: If the landing Queue has entries, its front Plane is copied to the parameter moving and a result land is returned. Otherwise, if the takeoff Queue has entries, its front Plane is copied to the parameter moving and a result takeoff is returned. Otherwise, idle is returned. Runway statistics are updated. Uses: class Extended_queue. */ { Runway_activity in_progress; if (!landing.empty()) { landing.retrieve(moving); land_wait += time - moving.started(); num_landings++; in_progress = land; landing.serve(); } else if (!takeoff.empty()) { takeoff.retrieve(moving); takeoff_wait += time - moving.started(); num_takeoffs++; in_progress = takeoff; takeoff.serve(); } else { idle_time++; in_progress = idle; } return in_progress; } void Runway::shut_down(int time) const /* Post: Runway usage statistics are summarized and printed. */ { cout << "Simulation has concluded after " << time << " time units." << endl << "Total number of planes processed " << (num_land_requests + num_takeoff_requests) << endl << "Total number of planes asking to land " << num_land_requests << endl << "Total number of planes asking to take off " << num_takeoff_requests << endl << "Total number of planes accepted for landing " << num_land_accepted << endl << "Total number of planes accepted for takeoff " << num_takeoff_accepted << endl << "Total number of planes refused for landing " << num_land_refused << endl << "Total number of planes refused for takeoff " << num_takeoff_refused << endl << "Total number of planes that landed " << num_landings << endl << "Total number of planes that took off " << num_takeoffs << endl << "Total number of planes left in landing queue " << landing.size() << endl << "Total number of planes left in takeoff queue " << takeoff.size() << endl; cout << "Percentage of time runway idle " << 100.0 * ((float)idle_time) / ((float)time) << "%" << endl; cout << "Average wait in landing queue " << ((float)land_wait) / ((float)num_landings) << " time units"; cout << endl << "Average wait in takeoff queue " << ((float)takeoff_wait) / ((float)num_takeoffs) << " time units" << endl; cout << "Average observed rate of planes wanting to land " << ((float)num_land_requests) / ((float)time) << " per time unit" << endl; cout << "Average observed rate of planes wanting to take off " << ((float)num_takeoff_requests) / ((float)time) << " per time unit" << endl; } 4 de mi filtro de autenticación de preautenticación? Intenté establecer la autenticación del #include "Runway.h" #include <iostream> using namespace std; Runway::Runway(int limit) /* Post: The Runway data members are initialized to record no prior Runway use and to record the limit on queue sizes. */ { queue_limit = limit; num_land_requests = num_takeoff_requests = 0; num_landings = num_takeoffs = 0; num_land_refused = num_takeoff_refused = 0; num_land_accepted = num_takeoff_accepted = 0; land_wait = takeoff_wait = idle_time = 0; } Error_code Runway::can_land(const Plane& current) /* Post: If possible, the Plane current is added to the landing Queue; otherwise, an Error_code of overflow is returned. The Runway statistics are updated. Uses: class Extended_queue. */ { Error_code result; if (landing.size() < queue_limit) result = landing.append(current); else result = fail; num_land_requests++; if (result != success) num_land_refused++; else num_land_accepted++; return result; } Error_code Runway::can_depart(const Plane& current) /* Post: If possible, the Plane current is added to the takeoff Queue; otherwise, an Error_code of overflow is returned. The Runway statistics are updated. Uses: class Extended_queue. */ { Error_code result; if (takeoff.size() < queue_limit) result = takeoff.append(current); else result = fail; num_takeoff_requests++; if (result != success) num_takeoff_refused++; else num_takeoff_accepted++; return result; } Runway_activity Runway::activity(int time, Plane& moving) /* Post: If the landing Queue has entries, its front Plane is copied to the parameter moving and a result land is returned. Otherwise, if the takeoff Queue has entries, its front Plane is copied to the parameter moving and a result takeoff is returned. Otherwise, idle is returned. Runway statistics are updated. Uses: class Extended_queue. */ { Runway_activity in_progress; if (!landing.empty()) { landing.retrieve(moving); land_wait += time - moving.started(); num_landings++; in_progress = land; landing.serve(); } else if (!takeoff.empty()) { takeoff.retrieve(moving); takeoff_wait += time - moving.started(); num_takeoffs++; in_progress = takeoff; takeoff.serve(); } else { idle_time++; in_progress = idle; } return in_progress; } void Runway::shut_down(int time) const /* Post: Runway usage statistics are summarized and printed. */ { cout << "Simulation has concluded after " << time << " time units." << endl << "Total number of planes processed " << (num_land_requests + num_takeoff_requests) << endl << "Total number of planes asking to land " << num_land_requests << endl << "Total number of planes asking to take off " << num_takeoff_requests << endl << "Total number of planes accepted for landing " << num_land_accepted << endl << "Total number of planes accepted for takeoff " << num_takeoff_accepted << endl << "Total number of planes refused for landing " << num_land_refused << endl << "Total number of planes refused for takeoff " << num_takeoff_refused << endl << "Total number of planes that landed " << num_landings << endl << "Total number of planes that took off " << num_takeoffs << endl << "Total number of planes left in landing queue " << landing.size() << endl << "Total number of planes left in takeoff queue " << takeoff.size() << endl; cout << "Percentage of time runway idle " << 100.0 * ((float)idle_time) / ((float)time) << "%" << endl; cout << "Average wait in landing queue " << ((float)land_wait) / ((float)num_landings) << " time units"; cout << endl << "Average wait in takeoff queue " << ((float)takeoff_wait) / ((float)num_takeoffs) << " time units" << endl; cout << "Average observed rate of planes wanting to land " << ((float)num_land_requests) / ((float)time) << " per time unit" << endl; cout << "Average observed rate of planes wanting to take off " << ((float)num_takeoff_requests) / ((float)time) << " per time unit" << endl; } 5 Pensamiento que dispararía automáticamente el #include "Utility.h" typedef char Queue_entry; const int maxqueue = 1000; // small value for testing class Queue { public: Queue(); bool empty() const; Error_code serve(); Error_code append(const Queue_entry& item); Error_code retrieve(Queue_entry& item) const; protected: int count; int front, rear; Queue_entry entry[maxqueue]; }; 16 pero no lo hace. Así es como intenté hacer eso:

  #include "Runway.h" #include <iostream> using namespace std;  Runway::Runway(int limit) /* Post:  The Runway data members are initialized to record no        prior Runway use and to record the limit on queue sizes. */  {     queue_limit = limit;     num_land_requests = num_takeoff_requests = 0;     num_landings = num_takeoffs = 0;     num_land_refused = num_takeoff_refused = 0;     num_land_accepted = num_takeoff_accepted = 0;     land_wait = takeoff_wait = idle_time = 0; }   Error_code Runway::can_land(const Plane& current) /* Post:  If possible, the Plane current is added to the        landing Queue; otherwise, an Error_code of overflow is        returned. The Runway statistics are updated. Uses:  class Extended_queue. */  {     Error_code result;     if (landing.size() < queue_limit)         result = landing.append(current);     else         result = fail;     num_land_requests++;      if (result != success)         num_land_refused++;     else         num_land_accepted++;      return result; }   Error_code Runway::can_depart(const Plane& current) /* Post:  If possible, the Plane current is added to the        takeoff Queue; otherwise, an Error_code of overflow is        returned. The Runway statistics are updated. Uses:  class Extended_queue. */  {     Error_code result;     if (takeoff.size() < queue_limit)         result = takeoff.append(current);     else         result = fail;     num_takeoff_requests++;     if (result != success)         num_takeoff_refused++;     else         num_takeoff_accepted++;      return result; }   Runway_activity Runway::activity(int time, Plane& moving) /* Post:  If the landing Queue has entries, its front        Plane is copied to the parameter moving        and a result  land is returned. Otherwise,        if the takeoff Queue has entries, its front        Plane is copied to the parameter moving        and a result  takeoff is returned. Otherwise,        idle is returned. Runway statistics are updated. Uses:  class Extended_queue. */  {     Runway_activity in_progress;     if (!landing.empty()) {         landing.retrieve(moving);         land_wait += time - moving.started();         num_landings++;         in_progress = land;         landing.serve();     }      else if (!takeoff.empty()) {         takeoff.retrieve(moving);         takeoff_wait += time - moving.started();         num_takeoffs++;         in_progress = takeoff;         takeoff.serve();     }      else {         idle_time++;         in_progress = idle;     }     return in_progress; }  void Runway::shut_down(int time) const /* Post: Runway usage statistics are summarized and printed. */  {     cout << "Simulation has concluded after " << time << " time units." << endl         << "Total number of planes processed "         << (num_land_requests + num_takeoff_requests) << endl         << "Total number of planes asking to land "         << num_land_requests << endl         << "Total number of planes asking to take off "         << num_takeoff_requests << endl         << "Total number of planes accepted for landing "         << num_land_accepted << endl         << "Total number of planes accepted for takeoff "         << num_takeoff_accepted << endl         << "Total number of planes refused for landing "         << num_land_refused << endl         << "Total number of planes refused for takeoff "         << num_takeoff_refused << endl         << "Total number of planes that landed "         << num_landings << endl         << "Total number of planes that took off "         << num_takeoffs << endl         << "Total number of planes left in landing queue "         << landing.size() << endl         << "Total number of planes left in takeoff queue "         << takeoff.size() << endl;     cout << "Percentage of time runway idle "         << 100.0 * ((float)idle_time) / ((float)time) << "%" << endl;     cout << "Average wait in landing queue "         << ((float)land_wait) / ((float)num_landings) << " time units";     cout << endl << "Average wait in takeoff queue "         << ((float)takeoff_wait) / ((float)num_takeoffs)         << " time units" << endl;     cout << "Average observed rate of planes wanting to land "         << ((float)num_land_requests) / ((float)time)         << " per time unit" << endl;     cout << "Average observed rate of planes wanting to take off "         << ((float)num_takeoff_requests) / ((float)time)         << " per time unit" << endl; } 7  

Lamentablemente, eso no funciona. Así que necesito saber cómo despedir el #include "Runway.h" #include <iostream> using namespace std; Runway::Runway(int limit) /* Post: The Runway data members are initialized to record no prior Runway use and to record the limit on queue sizes. */ { queue_limit = limit; num_land_requests = num_takeoff_requests = 0; num_landings = num_takeoffs = 0; num_land_refused = num_takeoff_refused = 0; num_land_accepted = num_takeoff_accepted = 0; land_wait = takeoff_wait = idle_time = 0; } Error_code Runway::can_land(const Plane& current) /* Post: If possible, the Plane current is added to the landing Queue; otherwise, an Error_code of overflow is returned. The Runway statistics are updated. Uses: class Extended_queue. */ { Error_code result; if (landing.size() < queue_limit) result = landing.append(current); else result = fail; num_land_requests++; if (result != success) num_land_refused++; else num_land_accepted++; return result; } Error_code Runway::can_depart(const Plane& current) /* Post: If possible, the Plane current is added to the takeoff Queue; otherwise, an Error_code of overflow is returned. The Runway statistics are updated. Uses: class Extended_queue. */ { Error_code result; if (takeoff.size() < queue_limit) result = takeoff.append(current); else result = fail; num_takeoff_requests++; if (result != success) num_takeoff_refused++; else num_takeoff_accepted++; return result; } Runway_activity Runway::activity(int time, Plane& moving) /* Post: If the landing Queue has entries, its front Plane is copied to the parameter moving and a result land is returned. Otherwise, if the takeoff Queue has entries, its front Plane is copied to the parameter moving and a result takeoff is returned. Otherwise, idle is returned. Runway statistics are updated. Uses: class Extended_queue. */ { Runway_activity in_progress; if (!landing.empty()) { landing.retrieve(moving); land_wait += time - moving.started(); num_landings++; in_progress = land; landing.serve(); } else if (!takeoff.empty()) { takeoff.retrieve(moving); takeoff_wait += time - moving.started(); num_takeoffs++; in_progress = takeoff; takeoff.serve(); } else { idle_time++; in_progress = idle; } return in_progress; } void Runway::shut_down(int time) const /* Post: Runway usage statistics are summarized and printed. */ { cout << "Simulation has concluded after " << time << " time units." << endl << "Total number of planes processed " << (num_land_requests + num_takeoff_requests) << endl << "Total number of planes asking to land " << num_land_requests << endl << "Total number of planes asking to take off " << num_takeoff_requests << endl << "Total number of planes accepted for landing " << num_land_accepted << endl << "Total number of planes accepted for takeoff " << num_takeoff_accepted << endl << "Total number of planes refused for landing " << num_land_refused << endl << "Total number of planes refused for takeoff " << num_takeoff_refused << endl << "Total number of planes that landed " << num_landings << endl << "Total number of planes that took off " << num_takeoffs << endl << "Total number of planes left in landing queue " << landing.size() << endl << "Total number of planes left in takeoff queue " << takeoff.size() << endl; cout << "Percentage of time runway idle " << 100.0 * ((float)idle_time) / ((float)time) << "%" << endl; cout << "Average wait in landing queue " << ((float)land_wait) / ((float)num_landings) << " time units"; cout << endl << "Average wait in takeoff queue " << ((float)takeoff_wait) / ((float)num_takeoffs) << " time units" << endl; cout << "Average observed rate of planes wanting to land " << ((float)num_land_requests) / ((float)time) << " per time unit" << endl; cout << "Average observed rate of planes wanting to take off " << ((float)num_takeoff_requests) / ((float)time) << " per time unit" << endl; } 8 de un filtro de autenticación.

Original en ingles

I want to provide the user an alternative means of logging in with a token. I already handle authenticating the user in the PreAuthenticationFilter class but then I need to fire my

AuthenticationSuccessHandler.onAuthenticationSuccess()

which does a

super.onAuthenticationSuccess()

which fires the method in it's base class of

SavedRequestAwareAuthenticationSuccessHandler.

How can I fire the AuthenticationSuccessHandler from my preauthentication filter? I tried setting the authentication of the SecurityContextHolder thinking it would automatically fire off the AuthenticationSuccessHandler but it does not. This is how I tried to do that:

Authentication authentication = new UsernamePasswordAuthenticationToken(Username, Password); SecurityContextHolder.getContext().setAuthentication(authentication); 

Unfortunately, that doesn't work though. So I need to know how to fire the AuthenticationSuccessHandler from a preauthentication filter.

        

Lista de respuestas

1
 
vote

Probablemente podría inspirarse en cómo el r124111 funciona en la seguridad de la primavera. Tiene una referencia al r1242 , y llama r1243 manualmente.

 

You could probably be inspired of how the RememberMeAuthenthicationFilter works in spring-security. It has a reference to the AuthenticationSuccessHandler, and calls onAuthenticationSuccess manually.

 
 
0
 
vote

Tienes que extender el preauthenticationFilter y sobrescribir la autenticación del método. Allí puede activar su controlador de éxito inyectado.

 

You have to extend the PreAuthenticationFilter and overwrite the method successfulAuthentication. There you can trigger your injected success handler.

 
 

Relacionados problema

2  Grieles problema de seguridad y optimización de motores de búsqueda  ( Grails security problem and search engine optimization ) 
Estoy tratando de crear una lógica de control que depende de la página GSP actual para llamar a una acción, ¿hay una etiqueta o un método de sesión que pueda ...

2  Spring MVC isFormsubmission () equivalente a anotaciones?  ( Spring mvc isformsubmission equivalent for annotations ) 
Con Spring MVC, es fácil expresar un concepto como "Un usuario está enviando el formulario si usan POST o si incluyen el parámetro 'ISSUMMIT'". Simplemente ex...

6  ¿El atributo desactivado de la forma de primavera realmente tiene que resolver una cadena?  ( Does spring form taglib disabled attribute really have to resolve to a string ) 
He estado jugando con la forma de primavera Taglib últimamente y encontré un fenómeno bastante perturbador. <form:select path="whatever" disabled="${true}"...

0  Problema de Spring-Json en Liferay con Spring 2.5  ( Spring json problem in liferay with spring 2 5 ) 
Estoy tratando de usar la biblioteca Spring-JSON.1.3.1 en un proyecto que se ha realizado con Liferay 5.1.2 que incluye la primavera 2.5. Siguiendo el sitio...

25  Vaadin y la integración de MVC de primavera  ( Vaadin and spring mvc integration ) 
Estoy pensando en la posibilidad de usar la primavera MVC con el marco de Vaadin. ¿Hay alguna forma documentada de hacer que jueguen bien juntos? También es u...

2  ¿La primavera va a combinar la MVC y WebFlow?  ( Is spring ever going to combine mvc and webflow ) 
Pensé que leí a Juergen Holler en algún lugar de una vez en el pasado, dijo que un objetivo futuro de la primavera era combinar la primavera MVC y WebFlow ......

0  Cómo insertar datos de dos tablas en un JSP en la primavera MVC An  ( How to insert data from two table in one jsp in spring mvc an ) 
IM usando SPRIVE MVC y intente insertar datos de dos tablas en un JSP Mis tablas: 1.Cars Id Name CityId(FK) 2.City Id Name He intentado a...

0  ¿En qué caso un programador obtendría la solicitud de ajuste web de despacho?  ( In what case would a programmer get the webapplicationcontext out of dispatchser ) 
Observo que hay getWebApplicationContext en org.springframework.web.servlet.mvc.AbstractController . Esto significa que los programadores de primavera pued...

0  ¿Cómo puedo pasar un valor personalizado a un Spring AOP conseje?  ( How can i pass a customized value to a spring aop advice ) 
Si tomo un método de servicio llamado public void delete(int id); como Pointcut, quiero agregar un consejo después de regreso, pero no sé qué tipo de objeto...

2  ¿Cómo puedo implementar un formulario de redireccionamiento después de la publicación con elAtrado de AnnotationMethodHandlerLapter?  ( How can i implement a redirect after post form with springs annotationmethodhan ) 
Me gustaría escribir un controlador de formulario de estilo @RequestMapping que redirige después de un error de validación y viajes de ida y vuelta en los val...




© 2022 respuesta.top Reservados todos los derechos. Centro de preguntas y respuestas reservados todos los derechos