public static void AuthorizeRegistration(this HttpRequestContext context, EndpointRegistration model, Endpoint modifiable, params SecurityRole[] roles) { if (modifiable?.Password == null || modifiable.Password == model?.Password?.ToSha256Hash()) return; Authorize(context, modifiable.Identity.Id, roles); }
public void EntityValidator_should_raise_validation_exception_if_endpoint_entity_token_is_short() { var endpoint = new EndpointRegistration { Address = "address", Group = "group", MonitorType = "http", Name = "name", Password = "******" }; Assert.Throws<ValidationException>(() => endpoint.ValidateModel()); }