ReckonJwt.AuthAPI (reckon_jwt v0.2.1)

View Source

Distributed authentication API for accessing the ReckonIdentityAuth service via Swarm.

This module provides a simple proxy to the authentication orchestrator running in the identity system. It mirrors the 5 public functions of ReckonIdentityAuth and forwards calls via Swarm cluster management.

Usage

# Full authentication
{:ok, result} = ReckonJwt.AuthAPI.authenticate(account_id, credentials, device_info, context)

# Token validation
{:ok, token_info} = ReckonJwt.AuthAPI.validate_token(token, context)

# Token refresh
{:ok, new_tokens} = ReckonJwt.AuthAPI.refresh_tokens(refresh_token, context)

# Logout
{:ok, %{logged_out: true}} = ReckonJwt.AuthAPI.logout(token, context)

# Service validation (lightweight)
{:ok, service_info} = ReckonJwt.AuthAPI.validate_service_token(token, required_scopes)

Configuration

config :reckon_jwt, ReckonJwt.AuthAPI,
  call_timeout: 30_000

Summary

Functions

Generate the service name for the authentication orchestrator.

Proxy to ReckonIdentityAuth.authenticate/4

Proxy to ReckonIdentityAuth.logout/2

Proxy to ReckonIdentityAuth.refresh_tokens/2

Proxy to ReckonIdentityAuth.validate_service_token/2

Proxy to ReckonIdentityAuth.validate_token/2

Functions

auth_service()

auth_service_name()

Generate the service name for the authentication orchestrator.

This creates a unique identifier for each node in the cluster, allowing multiple auth services to be registered simultaneously.

auth_service_pids()

authenticate(account_id, credentials, device_info, context \\ %{})

Proxy to ReckonIdentityAuth.authenticate/4

logout(token, context \\ %{})

Proxy to ReckonIdentityAuth.logout/2

refresh_tokens(refresh_token, context \\ %{})

Proxy to ReckonIdentityAuth.refresh_tokens/2

validate_service_token(token, required_scopes \\ [])

Proxy to ReckonIdentityAuth.validate_service_token/2

validate_token(token, context \\ %{})

Proxy to ReckonIdentityAuth.validate_token/2