title: Spring Boot with common Authentication
body: <p>I am trying to set up authentication server for spring boot application. I have multiple microservices application. Let say hospitals, patients, reports applications. I have each of microservices service application to be authenticated before allowing user to access the resources.
  Can I know how can I have common authentication logic as a separate application. let say authentication application. I am planning to us (spring security with Auth 2.0 and JWT token).</p>
  <p>For example:</p>
  <p>When user tries access hospital dashboard page, we will check the user is authenticated</p>
  <ul>
  <li><p>First we need to check whether user is authentication if not I need
  to redirect to login service in authentication application.</p>
  <p>Once user is logged in, then when he try to access dashboard we will
  check the token is valid. If valid then allow user to access the
  dashboard service.</p>
  </li>
  <li><p>Now user try to access patient details which is there in patient.war as a separate project, as the user already logged in we need to valid token, then we need to allow access to resources API what he is trying to access. If  token is invalid then we need to redirect to login page.</p>
  </li>
  </ul>
  <p>Question:</p>
  <ol>
  <li><p>I have gone through some example they have authentication server and resource server as separate application. i.e <strong>@EnableAuthenticationServer and @EnableResourceServer. But I have noted this got deprecated in latest spring boot version if I am right. Please correct me if I am wrong.</strong></p>
  </li>
  <li><p><strong>How can I have authentication functionality as common war file and let the other resource server access it before allowing the user to access the reset service API?</strong></p>
  </li>
  <li><p>Which is the right way to build a microservice application?</p>
  </li>
  </ol>
  <p>I need some experts help to understand the best approach we need to implement authentication and authorization in latest spring boot version.</p>