fix: proper introspection output format
@@ -4,6 +4,8 @@ import (
"fmt"
"time"
+ "github.com/ory/x/pointerx"
+
hydra "github.com/ory/hydra-client-go"
)
@@ -16,14 +18,33 @@ func (_ outputOAuth2TokenIntrospection) Header() []string {
}
func (i outputOAuth2TokenIntrospection) Columns() []string {
+ if i.Sub == nil {
+ i.Sub = pointerx.String("")
+ }
+
+ if i.ClientId == nil {
+ i.ClientId = pointerx.String("")
+ }
+
+ if i.Scope == nil {
+ i.Scope = pointerx.String("")
+ }
+
+ if i.TokenUse == nil {
+ i.TokenUse = pointerx.String("")
+ }
+
+ if i.Exp == nil {
+ i.Exp = pointerx.Int64(0)
+ }
+
return []string{
fmt.Sprintf("%v", i.Active),
- fmt.Sprintf("%v", i.Sub),
- fmt.Sprintf("%v", i.ClientId),
- fmt.Sprintf("%v", i.Scope),
- fmt.Sprintf("%v", i.Scope),
- fmt.Sprintf("%v", i.TokenUse),
+ fmt.Sprintf("%v", *i.Sub),
+ fmt.Sprintf("%v", *i.ClientId),
+ fmt.Sprintf("%v", *i.Scope),
fmt.Sprintf("%v", time.Unix(*i.Exp, 0).String()),
+ fmt.Sprintf("%v", *i.TokenUse),
}
}
