feat: add API key support for SPCS authentication#1244
Closed
costrouc wants to merge 2 commits intorstudio:mainfrom
Closed
feat: add API key support for SPCS authentication#1244costrouc wants to merge 2 commits intorstudio:mainfrom
costrouc wants to merge 2 commits intorstudio:mainfrom
Conversation
SPCS (Snowpark Container Services) deployments require a dual authentication model: - Snowflake tokens provide proxied authentication to reach the server - API keys identify the user to the Connect server itself Changes: - Updated authHeaders() to include X-RSC-Authorization header when both snowflakeToken and apiKey are present - Added apiKey parameter to connectSPCSUser() function - Updated getSPCSAuthedUser() to accept and use apiKey - Store apiKey in account registration alongside snowflakeConnectionName - Updated function documentation to explain the dual authentication model - Added comprehensive test coverage for API key handling This aligns with updated Connect server requirements for Snowflake SPCS deployments and mirrors the authentication pattern in rsconnect-python. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Document the addition of API key support for SPCS authentication, including the breaking change to connectSPCSUser() which now requires an apiKey parameter. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Member
Author
|
I will be testing this out on Monday |
Member
Author
|
Related PR posit-dev/rsconnect-python#715 |
Contributor
|
To test, install this branch like: remotes::install_github("costrouc/rsconnect", "feat-support-snowflake-spcs-oidc") |
Contributor
|
Replaced by #1248 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prior to recent changes on the Snowflake side, proxied authentication headers carried enough information for Connect running in Snowflake SPCS to identify users. With the move to OIDC, Connect servers no longer trust Snowflake headers for username identification. This requires users to provide both a Snowflake connection (for proxied authentication) and a Connect API key (for OIDC authentication).
Adds API key support for Snowflake SPCS (Snowpark Container Services) authentication due to changes in native application authentication using OIDC. Connect within the SPCS native application no longer relies on Snowflake headers to determine the user. You can think of the SPCS private key now only being used for proxied authentication to pass the request through and the api key is used by connect
Problem
SPCS deployments require a dual authentication model:
Previously,
connectSPCSUser()only handled Snowflake token authentication through thesnowflakeConnectionNameparameter. The API key was not captured or transmitted,preventing proper user identification by the Connect server.
Solution
apiKeyas a required parameter toconnectSPCSUser()authHeaders()to include the API key in theX-RSC-Authorizationheader whenboth
snowflakeTokenandapiKeyare presentapiKeyin account registration alongsidesnowflakeConnectionNameThis mirrors the authentication pattern implemented in
rsconnect-python#715.
Changes
R/http.R: ModifiedauthHeaders()to addX-RSC-Authorizationheader for SPCSR/accounts.R: UpdatedconnectSPCSUser()andgetSPCSAuthedUser()to accept and useAPI key
man/connectSPCSUser.Rd: Updated function documentationtests/testthat/test-spcs.R: Added test coverage for API key handlingNEWS.md: Documented the breaking changeBreaking Change
connectSPCSUser()now requires anapiKeyparameter. Existing code will need tobe updated:
Testing