mirror of
https://github.com/element-hq/lk-jwt-service.git
synced 2026-03-29 08:39:55 +00:00
Hack federation resolver so TLS check passes (#7)
As per comment. I don't yet know what the right way of doing this is.
This commit is contained in:
8
main.go
8
main.go
@@ -22,6 +22,7 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"time"
|
||||
|
||||
@@ -70,10 +71,15 @@ func exchangeOIDCToken(
|
||||
return nil, errors.New("No results returned from server name resolution!")
|
||||
}
|
||||
|
||||
// XXX: Remove trailing :443 from the hostname, otherwise the TLS cert will fail to verify
|
||||
// because it will include the port number. This clearly is not the right way of doing this
|
||||
// but right now I don't know what is.
|
||||
hackHostName := spec.ServerName(strings.TrimSuffix(string(resolveResults[0].Host), ":443"))
|
||||
|
||||
client := fclient.NewClient()
|
||||
// validate the openid token by getting the user's ID
|
||||
userinfo, err := client.LookupUserInfo(
|
||||
ctx, resolveResults[0].Host, token.AccessToken,
|
||||
ctx, hackHostName, token.AccessToken,
|
||||
)
|
||||
if err != nil {
|
||||
log.Printf("Failed to look up user info: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user