Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for decodeDockerConfigFieldAuth (0.41 sec)

  1. pkg/credentialprovider/config.go

    	toEncode.Auth = encodeDockerConfigFieldAuth(ident.Username, ident.Password)
    
    	return json.Marshal(toEncode)
    }
    
    // decodeDockerConfigFieldAuth deserializes the "auth" field from dockercfg into a
    // username and a password. The format of the auth field is base64(<username>:<password>).
    func decodeDockerConfigFieldAuth(field string) (username, password string, err error) {
    
    	var decoded []byte
    
    	// StdEncoding can only decode padded string
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 19 15:11:57 UTC 2023
    - 9.3K bytes
    - Viewed (0)
  2. pkg/credentialprovider/config_test.go

    			input: "Zm9vOmJhcg== ",
    			fail:  true,
    		},
    
    		// bad base64 data
    		{
    			input: "pants",
    			fail:  true,
    		},
    	}
    
    	for i, tt := range tests {
    		username, password, err := decodeDockerConfigFieldAuth(tt.input)
    		if (err != nil) != tt.fail {
    			t.Errorf("case %d: expected fail=%t, got err=%v", i, tt.fail, err)
    		}
    
    		if tt.username != username {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 19 15:11:57 UTC 2023
    - 10.7K bytes
    - Viewed (0)
Back to top