Socket
Socket
Sign inDemoInstall

@aws-sdk/credential-provider-sso

Package Overview
Dependencies
6
Maintainers
7
Versions
282
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @aws-sdk/credential-provider-sso

AWS credential provider that exchanges a resolved SSO login token file for temporary AWS credentials


Version published
Weekly downloads
15M
decreased by-17.34%
Maintainers
7
Created
Weekly downloads
 

Package description

What is @aws-sdk/credential-provider-sso?

The @aws-sdk/credential-provider-sso package is designed to facilitate the retrieval of AWS credentials using AWS Single Sign-On (SSO). This is particularly useful for developers and applications that need to authenticate against AWS services using SSO. The package simplifies the process of obtaining temporary credentials for AWS SDK clients.

What are @aws-sdk/credential-provider-sso's main functionalities?

Obtaining AWS credentials from SSO

This feature allows developers to obtain AWS credentials by specifying the SSO start URL, account ID, region, and role name. The credentials can then be used to authenticate AWS SDK clients.

const { fromSSO } = require('@aws-sdk/credential-provider-sso');
const client = new SomeAwsClient({
  credentials: fromSSO({
    ssoStartUrl: 'https://my-sso-start-url.example.com',
    ssoAccountId: '123456789012',
    ssoRegion: 'us-west-2',
    ssoRoleName: 'MyRoleName'
  })
});

Other packages similar to @aws-sdk/credential-provider-sso

Changelog

Source

3.22.0 (2021-07-16)

Bug Fixes

  • clients: link to Hash Interface (#2573) (bb7b3ed)
  • clients: prefix dist/ for typesVersions TS<4 (#2580) (dff5cd4)
  • codegen: fix detection of -s for generate-clients (#2588) (c989b76)
  • node-http-handler: throw meaningful errors in H2 events (#2568) (160aeba)

Features

  • clients: update clients as of 07/16/2021 (#2591) (f231e7c)
  • credential-provider-sso: support sso credential when resolving shared credential file (#2583) (9480e70)
  • postinstall-node-version-check: util to show NodeDeprecationWarning (#2585) (08c0342)

Readme

Source

@aws-sdk/credential-provider-sso

NPM version NPM downloads

AWS Credential Provider for Node.js - AWS Single Sign-On (SSO)

This module provides a function, fromSSO, that creates CredentialProvider functions that read from the resolved access token from local disk then requests temporary AWS credentials. For guidance on the AWS Single Sign-On service, please refer to AWS's Single Sign-On documentation.

You can create the CredentialProvider functions using the inline SSO parameters(ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName) or load them from AWS SDKs and Tools shared configuration and credentials files. Profiles in the credentials file are given precedence over profiles in the config file.

This credential provider is intended for use with the AWS SDK for Node.js.

This credential provider ONLY supports profiles using the SSO credential. If you have a profile that assumes a role which derived from the SSO credential, you should use the @aws-sdk/credential-provider-ini, or @aws-sdk/credential-provider-node package.

Supported configuration

You may customize how credentials are resolved by providing an options hash to the fromSSO factory function. The following options are supported:

  • ssoStartUrl: The URL to the AWS SSO service. Required if any of the sso* options(except for ssoClient) is provided.
  • ssoAccountId: The ID of the AWS account to use for temporary credentials. Required if any of the sso* options(except for ssoClient) is provided.
  • ssoRegion: The AWS region to use for temporary credentials. Required if any of the sso* options(except for ssoClient) is provided.
  • ssoRoleName: The name of the AWS role to assume. Required if any of the sso* options(except for ssoClient) is provided.
  • profile - The configuration profile to use. If not specified, the provider will use the value in the AWS_PROFILE environment variable or default by default.
  • filepath - The path to the shared credentials file. If not specified, the provider will use the value in the AWS_SHARED_CREDENTIALS_FILE environment variable or ~/.aws/credentials by default.
  • configFilepath - The path to the shared config file. If not specified, the provider will use the value in the AWS_CONFIG_FILE environment variable or ~/.aws/config by default.
  • ssoClient - The SSO Client used to request AWS credentials with the SSO access token. If not specified, a default SSO client will be created with the region specified in the profile sso_region entry.

SSO Login with the AWS CLI

This credential provider relies on the AWS CLI to log into an AWS SSO session. Here's a brief walk-through:

  1. Create a new AWS SSO enabled profile using the AWS CLI. It will ask you to login to your AWS SSO account and prompt for the name of the profile:
$ aws configure sso
...
...
CLI profile name [123456789011_ReadOnly]: my-sso-profile<ENTER>
  1. Configure your SDK client with the SSO credential provider:
import { fromSSO } from "@aws-sdk/credential-provider-sso"; // ES6 example
// const { fromSSO } = require(@aws-sdk/credential-provider-sso") // CommonJS example
//...
const client = new FooClient({ credentials: fromSSO({ profile: "my-sso-profile" });

Alternatively, the SSO credential provider is supported as a default Node.js credential provider:

import { defaultProvider } from "@aws-sdk/credential-provider-node"; // ES6 example
// const { defaultProvider } = require(@aws-sdk/credential-provider-node") // CommonJS example
//...
const client = new FooClient({ credentials: defaultProvider({ profile: "my-sso-profile" });
  1. To log out from the current SSO session, use the AWS CLI:
$ aws sso logout
Successfully signed out of all SSO profiles.

Sample files

This credential provider is only applicable if the profile specified in shared configuration and credentials files contain ALL of the following entries:

~/.aws/credentials

[sample-profile]
sso_account_id = 012345678901
sso_region = us-east-1
sso_role_name = SampleRole
sso_start_url = https://d-abc123.awsapps.com/start

~/.aws/config

[profile sample-profile]
sso_account_id = 012345678901
sso_region = us-east-1
sso_role_name = SampleRole
sso_start_url = https://d-abc123.awsapps.com/start

Keywords

FAQs

Last updated on 16 Jul 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc