Skip to content

🩹 [Patch]: Create fine-grained Context types #439

@MariusStorhaug

Description

@MariusStorhaug

Describe the change

Lets split out the context types into classes that are tailored to their use. We can add more derrived classes of the ones that exist. Something like the following:

  • User context
    • PAT based user context
      • No authentication app
      • Unknown expiry
      • Scope: All access that a user has access to, enterprise, organization, user, repos ++
      • Classic permissions (cannot be retrieved via API)
    • FG-PAT based user context
      • No app
      • Unknown expiry
      • Scoped to a user or an organization (cannot be retrieved via API).
      • Fine-grained permissions (cannot be retrieved via API).
    • UAT-GHA
      • AuthClientId
      • Refresh token
    • UAT-OAuth
      • AuthClientId
      • Scopes

System

  • App
    • Holds an app object in a "App" property.
    • App-KV
      • Key Vault reference
    • App-Local
      • Local secret
  • Installatino (GITHUB_TOKEN)
    • ?
  • Installation (managed)
    • Holds the installation object in a "installation" property.
    • Holds the App object in a "App" property.
    • UserInstallation
      • User (Account) and repo permissions
      • Target is always a user
    • OrgInstallation
      • Org (Account) and repo permissions
      • Target is always an org
    • EntInstallation
      • Enterprise (Account) permissions
      • Target is always an enterprise

Should we also restructure contexts abit?

[GitHubContextUser]
ID                    : github.com/MariusStorhaug
Name                  : github.com/MariusStorhaug
Token                 : System.Security.SecureString
Defaults:
    HostName              : github.com
    ApiBaseUri            : https://api.github.com
    ApiVersion            : 2022-11-28
    Enterprise            : 
    Owner                 : 
    Repository            : 
    HttpVersion           : 2.0
    PerPage               : 100

User:
    DisplayName           : Marius Storhaug
    NodeID                : MDQ6VXNlcjE3NzIyMjUz
    DatabaseID            : 17722253
    UserName              : MariusStorhaug

[GitHubContextUserPAT]
[GitHubContextUserFGPAT]
[GitHubContextUserGitHubApp]
AuthClientID          : Iv1.f26b61bc99e69405
TokenExpiresAt        : 20.09.2025 18:49:08
TokenExpiresIn        : 06:24:51.8017585
RefreshToken          : System.Security.SecureString
RefreshTokenExpiresAt : 20.03.2026 10:49:08
RefreshTokenExpiresIn : 180.22:24:51.7944143
[GitHubContextUserOAuthApp]
AuthClientID          : Iv1.f26b61bc99e69405
Scope                 : 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions