-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from neicnordic/200-provide-info-for-cli-login
Provide endpoint with info for sda-cli login
- Loading branch information
Showing
12 changed files
with
110 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/kataras/iris/v12" | ||
"github.com/neicnordic/crypt4gh/keys" | ||
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"` | ||
} | ||
|
||
// Reads the public key file and returns the public key | ||
func readPublicKeyFile(filename string) (key *[32]byte, err error) { | ||
log.Info("Reading Public key file") | ||
file, err := os.Open(filepath.Clean(filename)) | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer file.Close() | ||
publicKey, err := keys.ReadPublicKey(file) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &publicKey, err | ||
} | ||
|
||
// getInfo returns information needed by the client to authenticate | ||
func (auth AuthHandler) getInfo(ctx iris.Context) { | ||
info := Info{ClientID: auth.OAuth2Config.ClientID, OidcURI: auth.Config.Elixir.Provider, PublicKey: auth.pubKey, InboxURI: auth.Config.S3Inbox} | ||
|
||
err := ctx.JSON(info) | ||
if err != nil { | ||
log.Error("Failure to get Info ", err) | ||
|
||
return | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters