UNPKG

@aws-sdk/client-sts

Version:

AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native

98 lines (97 loc) 5.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DecodeAuthorizationMessageCommand = void 0; const middleware_serde_1 = require("@aws-sdk/middleware-serde"); const middleware_signing_1 = require("@aws-sdk/middleware-signing"); const smithy_client_1 = require("@aws-sdk/smithy-client"); const models_0_1 = require("../models/models_0"); const Aws_query_1 = require("../protocols/Aws_query"); /** * <p>Decodes additional information about the authorization status of a request from an * encoded message returned in response to an Amazon Web Services request.</p> * <p>For example, if a user is not authorized to perform an operation that he or she has * requested, the request returns a <code>Client.UnauthorizedOperation</code> response (an * HTTP 403 response). Some Amazon Web Services operations additionally return an encoded message that can * provide details about this authorization failure. </p> * <note> * <p>Only certain Amazon Web Services operations return an encoded authorization message. The * documentation for an individual operation indicates whether that operation returns an * encoded message in addition to returning an HTTP code.</p> * </note> * <p>The message is encoded because the details of the authorization status can constitute * privileged information that the user who requested the operation should not see. To decode * an authorization status message, a user must be granted permissions via an IAM policy to * request the <code>DecodeAuthorizationMessage</code> * (<code>sts:DecodeAuthorizationMessage</code>) action. </p> * <p>The decoded message includes the following type of information:</p> * <ul> * <li> * <p>Whether the request was denied due to an explicit deny or due to the absence of an * explicit allow. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-denyallow">Determining Whether a Request is Allowed or Denied</a> in the * <i>IAM User Guide</i>. </p> * </li> * <li> * <p>The principal who made the request.</p> * </li> * <li> * <p>The requested action.</p> * </li> * <li> * <p>The requested resource.</p> * </li> * <li> * <p>The values of condition keys in the context of the user's request.</p> * </li> * </ul> * @example * Use a bare-bones client and the command you need to make an API call. * ```javascript * import { STSClient, DecodeAuthorizationMessageCommand } from "@aws-sdk/client-sts"; // ES Modules import * // const { STSClient, DecodeAuthorizationMessageCommand } = require("@aws-sdk/client-sts"); // CommonJS import * const client = new STSClient(config); * const command = new DecodeAuthorizationMessageCommand(input); * const response = await client.send(command); * ``` * * @see {@link DecodeAuthorizationMessageCommandInput} for command's `input` shape. * @see {@link DecodeAuthorizationMessageCommandOutput} for command's `response` shape. * @see {@link STSClientResolvedConfig | config} for command's `input` shape. * */ class DecodeAuthorizationMessageCommand extends smithy_client_1.Command { // Start section: command_properties // End section: command_properties constructor(input) { // Start section: command_constructor super(); this.input = input; // End section: command_constructor } /** * @internal */ resolveMiddleware(clientStack, configuration, options) { this.middlewareStack.use(middleware_serde_1.getSerdePlugin(configuration, this.serialize, this.deserialize)); this.middlewareStack.use(middleware_signing_1.getAwsAuthPlugin(configuration)); const stack = clientStack.concat(this.middlewareStack); const { logger } = configuration; const clientName = "STSClient"; const commandName = "DecodeAuthorizationMessageCommand"; const handlerExecutionContext = { logger, clientName, commandName, inputFilterSensitiveLog: models_0_1.DecodeAuthorizationMessageRequest.filterSensitiveLog, outputFilterSensitiveLog: models_0_1.DecodeAuthorizationMessageResponse.filterSensitiveLog, }; const { requestHandler } = configuration; return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext); } serialize(input, context) { return Aws_query_1.serializeAws_queryDecodeAuthorizationMessageCommand(input, context); } deserialize(output, context) { return Aws_query_1.deserializeAws_queryDecodeAuthorizationMessageCommand(output, context); } } exports.DecodeAuthorizationMessageCommand = DecodeAuthorizationMessageCommand;