Skip to main content

Refresh principal token

Motivation​

Refreshes a valid principal token

Functional design​

POST /api/v2/apps/{owner}/{app}/auth/refresh

Headers​

KeyValue
Content-Typeapplication/json
AuthorizationBearer {PrincipalToken}

Parameters​

ParameterTypeDescription
ownerstringname of a user who owns the application
appstringname of an application

Result​

CodeDescriptionBody
200OKReturns a refreshed principal token, see below
400Bad Requesterror object
401Unauthorizederror object
403Forbiddenerror object
429Too may requests, rate limitingerror object
500+Server errors / service unavailableerror object

Example result 200:

{
"principalToken": "abc.def.ghi",
"expiresInSeconds": 3600, // seconds
"profileWSID": 1234567890
}

Technical design​

Components​

  • pkg/router
    • URL path handler ~cmp.routerRefreshHandler~covrd1✅
      • sends APIPath_Auth_Refresh request to QueryProcessor;
  • pkg/processors/query2
    • IApiPathHandler implementation for handling APIPath_Auth_Refresh in the AppWorkspace
      • ~cmp.authRefreshHandler~covrd2✅
        1. extracts profile WSID from token and makes federation post to refresh token:
        2. sends federation request to refresh token: ~cmp.authRefreshHandler.refreshToken~uncvrd3❓
    • newQueryProcessorPipeline: provide API handler for APIPath_Auth_Refresh
      • ~cmp.provideAuthRefreshHandler~covrd4✅
    • openapi:
      • add /auth/refresh to the list of API paths; ~cmp.provideAuthRefreshPath~covrd5✅
  • pkg/sys/it
    • integration test for /refresh
      • ~it.TestRefresh~covrd6✅

Footnotes​

  1. [~server.authnz/cmp.routerRefreshHandler~impl] pkg/router/impl_apiv2.go:448:impl ↩

  2. [~server.authnz/cmp.authRefreshHandler~impl] pkg/processors/query2/impl_auth_refresh_handler.go:17:impl ↩

  3. [~server.authnz/cmp.authRefreshHandler.refreshToken~impl] ↩

  4. [~server.authnz/cmp.provideAuthRefreshHandler~impl] pkg/processors/query2/impl.go:145:impl ↩

  5. [~server.authnz/cmp.provideAuthRefreshPath~impl] pkg/processors/query2/impl_openapi.go:458:impl ↩

  6. [~server.authnz/it.TestRefresh~impl] pkg/sys/it/impl_qpv2_test.go:2626:impl ↩