MCPcopy Index your code
hub / github.com/docker/docker-agent / printAuthInfoText

Function printAuthInfoText

cmd/root/debug_auth.go:107–139  ·  view source on GitHub ↗
(w io.Writer, info *authInfo)

Source from the content-addressed store, hash-verified

105}
106
107func printAuthInfoText(w io.Writer, info *authInfo) {
108 const previewLen = 10
109 if len(info.Token) <= previewLen*2 {
110 fmt.Fprintf(w, "Token: %s\n", info.Token)
111 } else {
112 fmt.Fprintf(w, "Token: %s...%s\n", info.Token[:previewLen], info.Token[len(info.Token)-previewLen:])
113 }
114
115 if info.Username != "" {
116 fmt.Fprintf(w, "Username: %s\n", info.Username)
117 }
118 if info.Email != "" {
119 fmt.Fprintf(w, "Email: %s\n", info.Email)
120 }
121 if info.Subject != "" {
122 fmt.Fprintf(w, "Subject: %s\n", info.Subject)
123 }
124 if info.Issuer != "" {
125 fmt.Fprintf(w, "Issuer: %s\n", info.Issuer)
126 }
127 if !info.IssuedAt.IsZero() {
128 fmt.Fprintf(w, "Issued at: %s\n", info.IssuedAt.Local().Format(time.RFC3339))
129 }
130 if !info.ExpiresAt.IsZero() {
131 fmt.Fprintf(w, "Expires at: %s\n", info.ExpiresAt.Local().Format(time.RFC3339))
132 }
133
134 if info.Expired {
135 fmt.Fprintln(w, "Status: ❌ Expired")
136 } else {
137 fmt.Fprintln(w, "Status: ✅ Valid")
138 }
139}

Callers 3

TestPrintAuthInfoTextFunction · 0.85
newDebugAuthCmdFunction · 0.85

Calls 1

IsZeroMethod · 0.45

Tested by 2

TestPrintAuthInfoTextFunction · 0.68