Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for ParseIdentity (0.15 sec)

  1. pkg/spiffe/spiffe.go

    	spiffeLog = log.RegisterScope("spiffe", "SPIFFE library logging")
    )
    
    type Identity struct {
    	TrustDomain    string
    	Namespace      string
    	ServiceAccount string
    }
    
    func ParseIdentity(s string) (Identity, error) {
    	if !strings.HasPrefix(s, URIPrefix) {
    		return Identity{}, fmt.Errorf("identity is not a spiffe format")
    	}
    	split := strings.Split(s[URIPrefixLen:], "/")
    	if len(split) != 5 {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu May 23 21:07:03 UTC 2024
    - 11.1K bytes
    - Viewed (0)
  2. pkg/spiffe/spiffe_test.go

    			nil,
    		},
    		{
    			// wrong separator /
    			"spiffe://td/ns/ns/foobar/sa/",
    			nil,
    		},
    	}
    	for _, tt := range cases {
    		t.Run(tt.input, func(t *testing.T) {
    			got, err := ParseIdentity(tt.input)
    			if tt.expected == nil {
    				if err == nil {
    					t.Fatalf("expected error, got %#v", got)
    				}
    				return
    			}
    			if err != nil {
    				t.Fatal(err)
    			}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu May 23 21:07:03 UTC 2024
    - 18.1K bytes
    - Viewed (0)
Back to top