Class JwtService
java.lang.Object
edu.ucsb.cs156.frontiers.services.JwtService
-
Constructor Summary
ConstructorsConstructorDescriptionJwtService
(org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder, com.fasterxml.jackson.databind.ObjectMapper objectMapper, org.springframework.data.auditing.DateTimeProvider dateTimeProvider) -
Method Summary
Modifier and TypeMethodDescriptiongetInstallationToken
(Course course) Method to retrieve a token to act as a particular app installation in a particular organizationgetJwt()
Method to retrieve a signed JWT that a service can use to authenticate with GitHub as an app installation without permissions to a specific organization.
-
Constructor Details
-
JwtService
public JwtService(org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder, com.fasterxml.jackson.databind.ObjectMapper objectMapper, org.springframework.data.auditing.DateTimeProvider dateTimeProvider)
-
-
Method Details
-
getJwt
Method to retrieve a signed JWT that a service can use to authenticate with GitHub as an app installation without permissions to a specific organization.- Returns:
- Signed JWT that expires in 5 minutes in the form of a String
- Throws:
InvalidKeySpecException
- if the key is invalid, the exception will be thrown.NoSuchAlgorithmException
-
getInstallationToken
public String getInstallationToken(Course course) throws com.fasterxml.jackson.core.JsonProcessingException, NoSuchAlgorithmException, InvalidKeySpecException, NoLinkedOrganizationException Method to retrieve a token to act as a particular app installation in a particular organization- Parameters:
course
- ID of the particular app installation to act as- Returns:
- Token accepted by GitHub to act as a particular installation.
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
NoSuchAlgorithmException
InvalidKeySpecException
NoLinkedOrganizationException
-