Retrieve e IAP Header from R Shiny Application Deployed on GCP protected by IAP

70 Views Asked by At

I have deployed an R shiny application to GCP cloud run with IAP to ensure the app is usable within a specific network. The application is meant to retrieve the IAP Header as well as the sys.info.

# Install required packages
# install.packages(c("shiny", "jsonlite"))
library(shiny)
library(jsonlite)

# Define the UI
ui <- fluidPage(
textOutput("Systable"),
textOutput("IAPTable"))

# Define the server
server <- function(input, output, session) {
IAP_Header<-reactive({
iap_header <- req()$HTTP_X_GOOG_IAP_JWT_ASSERTION    
# Decode the base64-encoded JSON payload
# iap_payload <- fromJSON(enc2utf8(strsplit(iap_header, "\\.")[[1]][2]))
return(iap_header)  })

output$Systable <- renderText({
  Sys.info() })
output$IAPTable <- renderText({
  IAP_Header()
})
 }   
# Run the Shiny app
shinyApp(ui, server)

There are two textoutputs-Systable and IAPTable. Systable is to get the system information, while IAPTable is meant to retrieve the IAPheader. I have deployed the application to cloudrun. The Application runs and I am able to get the Systable output. I am however, unable to get the IAPTable output. Is there some syntax that needs to be altered here. I request someone to take a look and guide me.

0

There are 0 best solutions below