public class OidcRefreshV1 extends java.lang.Object implements RestPluginProcess, RestPluginThrottling
POST /oidc/refreshThe frontend calls this endpoint when the current access token has expired. The refresh token is read from the HttpOnly cookie (set by the callback endpoint) and exchanged with Cognito for new access and ID tokens without requiring re-authentication.
The refresh token is never exposed in the response body. If Cognito issues a new refresh token, the cookie is updated automatically.
Returns HTTP 401 if no refresh token cookie is present or the refresh token has been revoked or expired.
| Modifier and Type | Field and Description |
|---|---|
static int |
RATE_LIMIT_PERIOD_SECONDS
Throttling period in seconds (1 minute).
|
static int |
RATE_LIMIT_REQUESTS
Maximum requests per throttling period.
|
| Constructor and Description |
|---|
OidcRefreshV1() |
| Modifier and Type | Method and Description |
|---|---|
static JSONObject |
buildErrorResponse()
Builds the JSON error response for a failed refresh attempt.
|
static JSONObject |
buildSuccessResponse(java.lang.String accessToken,
java.lang.String idToken,
int expiresIn)
Builds the JSON success response returned to the frontend.
|
java.lang.String |
getCounterKey(WebClient client,
RestDefinition restDefinition)
get the key of the throttling counter, the key has to be shorter than 255 characters
|
int |
getPeriod(WebClient client,
RestDefinition rd)
get the throttling period in seconds
|
int |
getRequestLimit(WebClient client,
RestDefinition rd)
-1 is no limit
0 is always reject
n is allow n requests in each throttling period
|
java.lang.Object |
restCreate(WebClient client,
RestDefinition restDefinition,
MutableDataSource mds)
HTTP POST calls the the Create ReST service.
|
java.lang.Object |
restDelete(WebClient client,
RestDefinition restDefinition,
MutableDataSource mds)
HTTP DELETE calls the the Delete ReST service.
|
java.lang.Object |
restRetrieve(WebClient client,
RestDefinition restDefinition,
ReadOnlyDataSource rds)
HTTP GET calls the the Retrieval ReST service.
|
java.lang.Object |
restUpdate(WebClient client,
RestDefinition restDefinition,
MutableDataSource mds)
HTTP PUT calls the the Update ReST service.
|
public static final int RATE_LIMIT_REQUESTS
public static final int RATE_LIMIT_PERIOD_SECONDS
@CheckReturnValue
@Nonnull
public java.lang.Object restRetrieve(@Nonnull
WebClient client,
@Nonnull
RestDefinition restDefinition,
@Nonnull
ReadOnlyDataSource rds)
throws java.lang.Exception
RestPluginProcessrestRetrieve in interface RestPluginProcessclient - the client. Null means check only of opsrestDefinition - the definitionrds - the data source to usejava.lang.UnsupportedOperationException - if this method is NOT supported.java.lang.Exception - an error has occurred.@CheckReturnValue
@Nonnull
public java.lang.Object restCreate(@Nonnull
WebClient client,
@Nonnull
RestDefinition restDefinition,
@Nonnull
MutableDataSource mds)
throws java.lang.Exception
RestPluginProcessrestCreate in interface RestPluginProcessclient - the client. Null means check only of opsrestDefinition - the definitionmds - the data source to usejava.lang.UnsupportedOperationException - if this method is NOT supported.ExceptionResponse - an error has occurred.java.lang.Exception@CheckReturnValue
@Nonnull
public java.lang.Object restUpdate(@Nonnull
WebClient client,
@Nonnull
RestDefinition restDefinition,
@Nonnull
MutableDataSource mds)
throws java.lang.Exception
RestPluginProcessrestUpdate in interface RestPluginProcessclient - the client. Null means check only of opsrestDefinition - the definitionmds - the data source to usejava.lang.UnsupportedOperationException - if this method is NOT supported.ExceptionResponse - an error has occurred.java.lang.Exception@CheckReturnValue
@Nonnull
public java.lang.Object restDelete(@Nonnull
WebClient client,
@Nonnull
RestDefinition restDefinition,
@Nonnull
MutableDataSource mds)
throws java.lang.Exception
RestPluginProcessrestDelete in interface RestPluginProcessclient - the client. Null means check only of opsrestDefinition - the definitionmds - the data source to use.java.lang.UnsupportedOperationException - if this method is NOT supported.ExceptionResponse - an error has occurred.java.lang.Exception@CheckReturnValue
@Nullable
public java.lang.String getCounterKey(@Nonnull
WebClient client,
@Nonnull
RestDefinition restDefinition)
throws java.lang.Exception
RestPluginThrottlinggetCounterKey in interface RestPluginThrottlingclient - the client. Null means check only of opsrestDefinition - the definitionjava.lang.UnsupportedOperationException - if this method is NOT supported.java.lang.Exception - an error has occurred.public int getRequestLimit(@Nonnull
WebClient client,
@Nonnull
RestDefinition rd)
throws java.lang.Exception
RestPluginThrottlinggetRequestLimit in interface RestPluginThrottlingclient - the client. Null means check only of opsrd - the definitionjava.lang.UnsupportedOperationException - use default throttling settings configured in RestDefinition recordjava.lang.Exceptionpublic int getPeriod(@Nonnull
WebClient client,
@Nonnull
RestDefinition rd)
throws java.lang.Exception
RestPluginThrottlinggetPeriod in interface RestPluginThrottlingclient - the client. Null means check only of opsrd - the definitionjava.lang.UnsupportedOperationException - use default throttling settings configured in RestDefinition recordjava.lang.Exception@CheckReturnValue @Nonnull public static JSONObject buildSuccessResponse(@Nonnull java.lang.String accessToken, @Nonnull java.lang.String idToken, int expiresIn)
The refresh token is deliberately excluded from the response body for security — it is only ever stored in the HttpOnly cookie.
accessToken - the OAuth2 access tokenidToken - the OpenID Connect ID tokenexpiresIn - the token lifetime in seconds@CheckReturnValue @Nonnull public static JSONObject buildErrorResponse()
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.