Skip to main content

Auth: hbf-core

How this service handles authentication. Full flows: docs/architecture/auth-flows.md

Tokens This Service Accepts

Token typeWhere validatedGuard / middleware
User JWT (login type)TokenAuthenticationFilter (OncePerRequestFilter). HS256 signature check, issuer = hbf-auth, expiry check, type must be login.Spring Security filter chain
API Token (api_token type)Same filter. Separate signing secret (APP_SECURITY_API_DEPLOYMENT_TOKEN_SECRET). Type must be api_token.Spring Security filter chain
Refresh Token (refresh_token type)Accepted only at POST /login/refresh. Validated by the login controller, not the general filter.Login controller logic

Public endpoints (no token required): /, /public/**, /login/**, /swagger-ui/**, /v3/api-docs/**, /actuator/health/**, /robots.txt

Tokens This Service Sends

CallingToken usedHow attached
hbf-notifications (NotificationServiceClient)Service-to-service bearer token from helvia.notification-service.token env varAuthorization: Bearer <token> header

Tokens This Service Issues

TokenLifetimePurpose
User JWT24 hoursGeneral authenticated access
Refresh Token7 daysObtain a new User JWT without re-authenticating
API TokenNo expiryMachine-to-machine / deployment access
Email Verification Token3 hoursConfirm user email address
Forgot Password Token15 minutesPassword reset link
User Invitation Token7 daysInvite a user to an organization

Login endpoints that issue tokens:

  • POST /login (email + password credentials)
  • POST /login/google
  • POST /login/microsoft
  • POST /login/teams
  • POST /login/integration (OIDC / custom)
  • POST /login/refresh (exchanges refresh token for new JWT)

Roles / Scopes Enforced

Two-tier RBAC with @PreAuthorize annotations delegating to SecurityServiceImpl methods.

Organization roles:

RoleDescription
HBF_ORG_ADMINFull org management
HBF_ORG_EDITOREdit org resources
HBF_ORG_VIEWERRead-only org access
HBF_ORG_LIVE_AGENTLive agent capabilities
HBF_ORG_LIVECHAT_ADMINLivechat administration
HRWIZ_EMPLOYEEHR Wizard employee role

Tenant roles:

RoleDescription
HBF_TENANT_ADMINFull tenant management
HBF_TENANT_EDITOREdit tenant resources
HBF_TENANT_VIEWERRead-only tenant access
HBF_TENANT_LIVECHAT_ADMINTenant-level livechat administration

Super-admin: The isModerator flag bypasses standard role checks.

Auth Notes

  • Account lockout activates after 10 consecutive failed login attempts.
  • Sessions are fully stateless. No server-side session storage.
  • CSRF protection is disabled (stateless JWT-based auth).
  • API tokens use a separate signing secret (APP_SECURITY_API_DEPLOYMENT_TOKEN_SECRET), distinct from the user JWT secret.
  • Post-authentication callbacks exist but are disabled by default.
  • All JWTs are signed with HS256 using a Base64-encoded secret.