mirror of
https://github.com/bolkedebruin/rdpgw.git
synced 2025-08-18 06:23:49 +02:00
Verify access key as part of PAA verification
This commit is contained in:
parent
93c558786f
commit
db00ce7be0
2 changed files with 15 additions and 2 deletions
|
@ -6,8 +6,10 @@ import (
|
|||
"fmt"
|
||||
"github.com/bolkedebruin/rdpgw/common"
|
||||
"github.com/bolkedebruin/rdpgw/protocol"
|
||||
"github.com/coreos/go-oidc/v3/oidc"
|
||||
"github.com/square/go-jose/v3"
|
||||
"github.com/square/go-jose/v3/jwt"
|
||||
"golang.org/x/oauth2"
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
|
@ -17,6 +19,8 @@ var (
|
|||
EncryptionKey []byte
|
||||
UserSigningKey []byte
|
||||
UserEncryptionKey []byte
|
||||
OIDCProvider *oidc.Provider
|
||||
Oauth2Config oauth2.Config
|
||||
)
|
||||
|
||||
var ExpiryTime time.Duration = 5
|
||||
|
@ -58,6 +62,14 @@ func VerifyPAAToken(ctx context.Context, tokenString string) (bool, error) {
|
|||
return false, err
|
||||
}
|
||||
|
||||
// validate the access token
|
||||
tokenSource := Oauth2Config.TokenSource(ctx, &oauth2.Token{AccessToken: custom.AccessToken})
|
||||
_, err = OIDCProvider.UserInfo(ctx, tokenSource)
|
||||
if err != nil {
|
||||
log.Printf("Cannot get user info for access token: %s", err)
|
||||
return false, err
|
||||
}
|
||||
|
||||
s := getSessionInfo(ctx)
|
||||
|
||||
s.RemoteServer = custom.RemoteServer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue