# User Authentication

If you enabled the Authentication microservice, additional services are pre-wired to use it for pass-through authentication.

Within other microservices, use the `@Securty('jwt')` annotation in the Controller on methods to enforce that an `Authorization` header is required with the request.

![](/files/tv9XAdyIzeMF5t8hgwqC)

### Testing Authentication Locally

Microservices running **Locally** are configured to allow authentication tokens from the **Nonlive** environment.

Go to the [Scaffoldly Dashboard](https://start.scaffold.ly/dashboard) and find the JWT Token Generator

![](/files/BbrtbgFj4rjgJU2vPBO0)

By default, emails can only be sent to your Scaffoldly email account, also shown on the Dashboard

![](/files/3FOzydegPym11dEm5TdU)

![](/files/YghIRe3fSdLE3BrAB1tT) ![](/files/bQEadhvJ8zPtwUzI6W0v) ![](/files/fGGUETYyPIAhEWUAy6I2) ![](/files/Rg0ywOksu3MTNygEiULq)

Run your [Microservice locally](/how-tos/microservices/running-locally.md) (optionally in [Debug Mode](/how-tos/microservices/running-locally.md#debug-the-application)), and open the [Swagger UI](/how-tos/microservices/running-locally.md#use-the-application)

Click **Authorize** and paste the token, and invoke an endpoint with the padlock icon.

If you've set a breakpoint, you can see that the `httpRequest.user` is populated with the user's identity.

![](/files/aDx4KFuKYJipk2xF357G) ![](/files/jYmT7xLg9DP3CHG22Bbj) ![](/files/Q3PaTQ3y7p52SJAo8LR0) ![](/files/TbciJ1pFYYVnZf1iji8C) ![](/files/fW0gpR4nYHN7gorhTG28)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scaffold.ly/how-tos/microservices/user-authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
