auth

Paddy 2014-10-26 Parent:e45bfa2abc00 Child:0a6e3f14b054

58:b3cd7765a7c8 Go to Latest

auth/client_test.go

Require full URLs for Endpoints. The spec says that we SHOULD require full URLs for redirection, but we _can_ offer the ability to set a URL as a "partial URL" if we really must. I see no particular reason to do this, so I've simplified the code by pulling that option out. This means that URLs (as long as they're normalized, which I've filed a bug in the codebase to do) can be checked using simple string comparison, which makes the likelihood of bugs across clientStorage implementations a lot lower.

History
     1.1 --- a/client_test.go	Sun Oct 26 00:53:36 2014 -0400
     1.2 +++ b/client_test.go	Sun Oct 26 03:22:41 2014 -0400
     1.3 @@ -317,7 +317,7 @@
     1.4  	candidates := map[string]bool{
     1.5  		"https://www.example.com/":                 false,
     1.6  		"https://www.example.com/first":            true,
     1.7 -		"https://www.example.com/first/extra/path": true,
     1.8 +		"https://www.example.com/first/extra/path": false,
     1.9  		"https://www.example.com/my":               false,
    1.10  		"https://www.example.com/my/full/path":     true,
    1.11  	}
    1.12 @@ -335,7 +335,7 @@
    1.13  			t.Fatalf("Error saving endpoint in %T: %s", store, err)
    1.14  		}
    1.15  		for candidate, expectation := range candidates {
    1.16 -			result, err := store.checkEndpoint(client.ID, candidate, false)
    1.17 +			result, err := store.checkEndpoint(client.ID, candidate)
    1.18  			if err != nil {
    1.19  				t.Fatalf("Error checking endpoint %s in %T: %s", candidate, store, err)
    1.20  			}
    1.21 @@ -397,7 +397,7 @@
    1.22  			t.Fatalf("Error saving endpoint in %T: %s", store, err)
    1.23  		}
    1.24  		for candidate, expectation := range candidates {
    1.25 -			result, err := store.checkEndpoint(client.ID, candidate, true)
    1.26 +			result, err := store.checkEndpoint(client.ID, candidate)
    1.27  			if err != nil {
    1.28  				t.Fatalf("Error checking endpoint %s in %T: %s", candidate, store, err)
    1.29  			}