Skip to content

Commit

Permalink
More logs
Browse files Browse the repository at this point in the history
  • Loading branch information
VeryBigCorp committed Mar 17, 2024
1 parent 0712af8 commit 0aa3607
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ func (c *Client) ActivateSession(ctx context.Context, s *Session) error {
tok.EncryptionAlgorithm = passAlg

case *ua.X509IdentityToken:
debug.Printf("Using X509 Identity Token...")
tokSig, tokSigAlg, err := c.SecureChannel().NewUserTokenSignature(s.cfg.AuthPolicyURI, s.serverCertificate, s.serverNonce)
if err != nil {
log.Printf("error creating session signature: %s", err)
Expand Down Expand Up @@ -882,6 +883,7 @@ func (c *Client) ActivateSession(ctx context.Context, s *Session) error {
debug.Printf("Activate session request: %+v", req)
debug.Printf("Activate session signature: %+v", req.ClientSignature)
debug.Printf("User identity token: %+v", req.UserIdentityToken)
debug.Printf("User identity token signature: %+v", req.UserTokenSignature)
return c.SecureChannel().SendRequest(ctx, req, s.resp.AuthenticationToken, func(v interface{}) error {
var res *ua.ActivateSessionResponse
if err := safeAssign(v, &res); err != nil {
Expand Down
4 changes: 4 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"strings"
"time"

"github.com/gopcua/opcua/debug"
"github.com/gopcua/opcua/errors"
"github.com/gopcua/opcua/ua"
"github.com/gopcua/opcua/uacp"
Expand Down Expand Up @@ -349,6 +350,7 @@ func SecurityFromEndpoint(ep *ua.EndpointDescription, authType ua.UserTokenType)
continue
}

debug.Printf("Token: %+v", t)
if cfg.session.UserIdentityToken == nil {
switch authType {
case ua.UserTokenTypeAnonymous:
Expand All @@ -367,6 +369,8 @@ func SecurityFromEndpoint(ep *ua.EndpointDescription, authType ua.UserTokenType)
return nil
}

debug.Printf("Session: %+v", cfg.session)

if cfg.session.UserIdentityToken == nil {
cfg.session.UserIdentityToken = &ua.AnonymousIdentityToken{PolicyID: defaultAnonymousPolicyID}
cfg.session.AuthPolicyURI = ua.SecurityPolicyURINone
Expand Down
2 changes: 1 addition & 1 deletion ua/extobjs_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0aa3607

Please sign in to comment.