authenticate
Authenticates a user using a Microsoft Azure AD JWT token and returns a Satélite session with user details, permissions, and a new session token.Mutation Signature
This mutation is marked with
[AllowAnonymous] and does not require a Satélite session token. However, it requires a valid Azure AD JWT token in the Authorization header.Headers
Microsoft Azure AD JWT token in the format:
Bearer <AZURE_AD_TOKEN>The token must contain:unique_nameorupnclaim with email ending in@moderna.com.ecnameclaim with the user’s full name
Response
Returns aSessionDTO object containing:
JWT session token for subsequent API requests. Valid for 120 minutes.This token contains:
sub- User IDemail- User emailrol- User role IDscopes- User permissions array
Authenticated user information
List of permissions assigned to the user
Dynamically generated menu items based on user permissions
Example Request
Example Response
Response Headers
The API also returns the session token in the response headers:Error Responses
Error Codes
Returned when:
- Azure AD token is missing or invalid
- Email domain is not
@moderna.com.ec - User account is inactive (
activo = false) - User has no permissions assigned
Authentication Flow
Obtain Azure AD Token
Authenticate with Microsoft Azure AD using your organization credentials to obtain a JWT token.
Call authenticate Mutation
Send a GraphQL mutation request to
authenticate with the Azure AD token in the Authorization header.Use Session Token
Include the session token in the
Authorization header for all subsequent API requests:Implementation Notes
Token Validation
The authentication process validates the Azure AD token by:- Extracting the token from the
Authorizationheader (removing “Bearer ” prefix) - Reading JWT claims using
JwtSecurityTokenHandler - Looking for email in
unique_nameorupnclaims - Verifying the email ends with
@moderna.com.ec - Extracting the user’s name from the
nameclaim
User Creation
New users are automatically created when they authenticate for the first time. The system:- Checks if a user with the email exists in the database
- If not found, creates a new user with:
- Email from the Azure AD token
- Name from the Azure AD token
- Active status set to
true - Current timestamp as
CreatedAt
Permission Loading
The system loads:- User permissions from the
Usuarios_Permisostable - Associated menu items for each permission
- Permission details including names and IDs
Token Generation
The Satélite session token is generated with:- Algorithm: HMAC SHA-256
- Expiration: 120 minutes from generation
- Claims: User ID, email, role ID, and scopes
- Scopes: Dynamically assigned based on permissions (e.g., users with “Vista Usuario” permission receive
user:impersonatescope)