Skip to content

get_current_user

get_current_user(
    authentication_token: AuthenticationHeaderType,
    *,
    config_overrides: Optional[WorkDocsClientConfig] = None,
) -> GetCurrentUserResponse

Retrieves details of the current user for whom the authentication token was generated. This is not a valid action for SigV4 (administrative API) clients.

This action requires an authentication token. To get an authentication token, register an application with Amazon WorkDocs. For more information, see Authentication and Access Control for User Applications in the Amazon WorkDocs Developer Guide.

Parameters:

Raises:

Source code in docs_src/capo_workdocs/_services/work_docs.py
def get_current_user(
    self,
    authentication_token: "capo_workdocs.types.authentication_header_type.AuthenticationHeaderType",
    *,
    config_overrides: Optional[WorkDocsClientConfig] = None,
) -> "capo_workdocs.types.get_current_user_response.GetCurrentUserResponse":
    """<p>Retrieves details of the current user for whom the authentication token was generated. This is not a valid action for SigV4 (administrative API) clients.</p> <p>This action requires an authentication token. To get an authentication token, register an application with Amazon WorkDocs. For more information, see <a href="https://docs.aws.amazon.com/workdocs/latest/developerguide/wd-auth-user.html">Authentication and Access Control for User Applications</a> in the <i>Amazon WorkDocs Developer Guide</i>.</p>

    Args:
        authentication_token: <p>Amazon WorkDocs authentication token.</p>

    Raises:
        capo_workdocs.errors.entity_not_exists_exception.EntityNotExistsException: <p>The resource does not exist.</p>
        capo_workdocs.errors.failed_dependency_exception.FailedDependencyException: <p>The Directory Service cannot reach an on-premises instance. Or a dependency under the control of the organization is failing, such as a connected Active Directory.</p>
        capo_workdocs.errors.service_unavailable_exception.ServiceUnavailableException: <p>One or more of the dependencies is unavailable.</p>
        capo_workdocs.errors.unauthorized_operation_exception.UnauthorizedOperationException: <p>The operation is not permitted.</p>
        capo_workdocs.errors.unauthorized_resource_access_exception.UnauthorizedResourceAccessException: <p>The caller does not have access to perform the action on the resource.</p>
        capo_workdocs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_workdocs.types.get_current_user_request.GetCurrentUserRequest]",
    ) -> OperationResponse[
        "capo_workdocs.types.get_current_user_response.GetCurrentUserResponse"
    ]:
        import capo_workdocs._operations.aws_gorilla_boy_service.get_current_user

        output, http_response = (
            capo_workdocs._operations.aws_gorilla_boy_service.get_current_user.get_current_user(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_workdocs.types.get_current_user_request.GetCurrentUserRequest",
    ) -> dict[str, Any]:
        import capo_workdocs.types.get_current_user_request

        return capo_workdocs.types.get_current_user_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_workdocs.types.get_current_user_response.GetCurrentUserResponse",
    ) -> dict[str, Any]:
        import capo_workdocs.types.get_current_user_response

        return capo_workdocs.types.get_current_user_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "GetCurrentUser",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_workdocs.types.get_current_user_request.GetCurrentUserRequest = {
        "authentication_token": authentication_token
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output