Skip to content

Commit

Permalink
#200: Provide endpoint with info for sda-cli login
Browse files Browse the repository at this point in the history
  • Loading branch information
pahatz committed Jun 26, 2023
1 parent c73d3d1 commit aa2df17
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
28 changes: 28 additions & 0 deletions sda-auth/info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"github.com/kataras/iris/v12"
log "github.com/sirupsen/logrus"
)

type Info struct {
ClientID string `json:"client_id"`
OidcURI string `json:"oidc_uri"`
PublicKey string `json:"public_key"`
InboxURI string `json:"inbox_uri"`
}

func (auth AuthHandler) getInfo(ctx iris.Context) {
log.Println("in getInfo")

if auth.OAuth2Config.ClientID != "" && auth.Config.JwtIssuer != "" && auth.Config.S3Inbox != "" {
info := Info{ClientID: auth.OAuth2Config.ClientID, OidcURI: auth.Config.JwtIssuer, PublicKey: "todo.pub", InboxURI: auth.Config.S3Inbox}
//infoJ, err := json.Marshal(info)
err := ctx.JSON(info)
if err != nil {
log.Error("Failure to get Info ", err)

return
}
}
}
1 change: 1 addition & 0 deletions sda-auth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ func main() {
app.Get("/elixir/s3conf", authHandler.getElixirConf)
app.Get("/elixir/login", authHandler.getElixirLogin)
app.Get("/elixir/cors_login", authHandler.getElixirCORSLogin)
app.Get("/info", authHandler.getInfo)

app.UseGlobal(globalHeaders)

Expand Down

0 comments on commit aa2df17

Please sign in to comment.