Skip to content

Commit e4fba39

Browse files
committed
fixup! chore(coderd): add tests for big oidc tokens
1 parent ebd95f4 commit e4fba39

File tree

1 file changed

+0
-39
lines changed

1 file changed

+0
-39
lines changed

coderd/userauth.go

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ import (
66
"encoding/json"
77
"errors"
88
"fmt"
9-
"io"
109
"net/http"
1110
"net/mail"
1211
"regexp"
1312
"sort"
1413
"strconv"
1514
"strings"
1615
"sync"
17-
"sync/atomic"
1816
"time"
1917

2018
"github.com/coreos/go-oidc/v3/oidc"
@@ -1191,26 +1189,6 @@ func blankFields(claims map[string]interface{}) []string {
11911189
return fields
11921190
}
11931191

1194-
// fieldSizes returns the sorted sizes of fields in the claims map
1195-
func fieldSizes(claims map[string]interface{}) []int {
1196-
fs := claimFields(claims)
1197-
lens := make([]int, len(fs))
1198-
for i, f := range fs {
1199-
v, ok := claims[f]
1200-
if !ok {
1201-
lens[i] = -1
1202-
continue
1203-
}
1204-
vs, ok := v.(string)
1205-
if !ok {
1206-
lens[i] = -1
1207-
continue
1208-
}
1209-
lens[i] = len(vs)
1210-
}
1211-
return lens
1212-
}
1213-
12141192
// mergeClaims merges the claims from a and b and returns the merged set.
12151193
// claims from b take precedence over claims from a.
12161194
func mergeClaims(a, b map[string]interface{}) map[string]interface{} {
@@ -1894,20 +1872,3 @@ func parseStringSliceClaim(claim interface{}) ([]string, error) {
18941872
// Not sure what the user gave us.
18951873
return nil, xerrors.Errorf("invalid claim type. Expected an array of strings, got: %T", claim)
18961874
}
1897-
1898-
type countWriter struct {
1899-
w io.Writer
1900-
bytesWritten atomic.Int64
1901-
}
1902-
1903-
func (cw *countWriter) Write(p []byte) (int, error) {
1904-
n, err := cw.w.Write(p)
1905-
if n > 0 {
1906-
cw.bytesWritten.Add(int64(n))
1907-
}
1908-
return n, err
1909-
}
1910-
1911-
func (cw *countWriter) Length() int {
1912-
return int(cw.bytesWritten.Load())
1913-
}

0 commit comments

Comments
 (0)