stop panicing because the issuer port is invalid. (#1282)
This commit is contained in:
2 files changed
+20
-1
No files matched your search
@@ -994,7 +994,7 @@ func validateUpdateRequest(req *pbs.UpdateAuthMethodRequest) error {
|
||||
if err != nil {
|
||||
badFields[issuerField] = fmt.Sprintf("Cannot be parsed as a url. %v", err)
|
||||
}
|
||||
if !strutil.StrListContains([]string{"http", "https"}, iss.Scheme) {
|
||||
if iss != nil && !strutil.StrListContains([]string{"http", "https"}, iss.Scheme) {
|
||||
badFields[issuerField] = fmt.Sprintf("Must have schema %q or %q specified", "http", "https")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,6 +430,25 @@ func TestUpdate_OIDC(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "invalid-issuer-port",
|
||||
req: &pbs.UpdateAuthMethodRequest{
|
||||
UpdateMask: &field_mask.FieldMask{
|
||||
Paths: []string{"attributes.issuer"},
|
||||
},
|
||||
Item: &pb.AuthMethod{
|
||||
Attributes: &structpb.Struct{
|
||||
Fields: func() map[string]*structpb.Value {
|
||||
f := defaultAttributeFields()
|
||||
f["issuer"] = structpb.NewStringValue("http://localhost:7dddd")
|
||||
f["disable_discovered_config_validation"] = structpb.NewBoolValue(true)
|
||||
return f
|
||||
}(),
|
||||
},
|
||||
},
|
||||
},
|
||||
err: handlers.ApiErrorWithCode(codes.InvalidArgument),
|
||||
},
|
||||
{
|
||||
name: "No Update Mask",
|
||||
req: &pbs.UpdateAuthMethodRequest{
|
||||
|
||||
Reference in new issue
Block a user