Skip to content

Conversation

mshahzaib-travis
Copy link
Contributor

@mshahzaib-travis mshahzaib-travis commented Jul 6, 2025

Summary

This PR adds a JWT-protected /assembla/login endpoint to Travis API for seamless Assembla user onboarding and sync.

  • Only allows requests from configured Assembla clusters and when deep integration is enabled.
  • On success, creates or finds the user and triggers a Travis VCS sync.

**Endpoint Parameters **
It accepts id, name, email, login, space_id, access_token, refresh_token as protected JWT parameters and returns { user_id: USER_ID, login: USER_LOGIN, token: USER_TOKEN, status: SIGNIN_STATUS }

Setup

To use this integration, set the following environment variables in your Travis API environment:

  • ASSEMBLA_JWT_SECRET - Shared secret for JWT validation.
  • ASSEMBLA_CLUSTERS - Comma-separated list of allowed Assembla clusters.
  • DEEP_INTEGRATION_ENABLED - Set to true to enable the integration.

@piccadilly-circus
Copy link
Contributor

Let's re-review it after the changes requested are made.

Comment on lines +42 to +51
halt 403, { error: 'Deep integration not enabled' } unless deep_integration_enabled?
halt 403, { error: 'Invalid ASM cluster' } unless valid_asm_cluster?
@jwt_payload = verify_jwt(request)
check_required_fields
end

def check_required_fields
missing = REQUIRED_JWT_FIELDS.select { |f| @jwt_payload[f].nil? || @jwt_payload[f].to_s.strip.empty? }
unless missing.empty?
halt 400, { error: 'Missing required fields', missing: missing }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe create a config and add all error messages to that so it is easy to see all errors this integration can generate and then use that config where you are raising the error.

@mshahzaib-travis
Copy link
Contributor Author

@piccadilly-circus @murtaza-swati Need this PR to be reviewed again as couple of changes made that came up during testing

@gbarc-dt gbarc-dt changed the base branch from master to prd-asm_integration_dev August 12, 2025 07:34
@mshahzaib-travis mshahzaib-travis merged commit 21c3d1a into prd-asm_integration_dev Aug 12, 2025
0 of 2 checks passed
@mshahzaib-travis mshahzaib-travis deleted the TBT-381-assembla-jwt-login-endpoint branch August 12, 2025 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants