and I have a qustion : I don’t add AuthFeature to Plugins, when I visitd a ServiceStackController marked ‘Authenticate’ ,
it redirect to ‘/logon’ (may be a mistake in mvc5 project it should be /api/logon ?) but the source at ‘AuthenticateAttribute’ is
public override void Execute(IRequest req, IResponse res, object requestDto)
{
if (AuthenticateService.AuthProviders == null)
throw new InvalidOperationException(
"The AuthService must be initialized by calling AuthService.Init to use an authenticate attribute");
if (HostContext.HasValidAuthSecret(req))
return;
var matchingOAuthConfigs = AuthenticateService.AuthProviders.Where(x =>
this.Provider.IsNullOrEmpty()
|| x.Provider == this.Provider).ToList();
if (matchingOAuthConfigs.Count == 0) //I think this should be true if I don't add AuthFeature so AuthProviders count=0
{
res.WriteError(req, requestDto, $"No OAuth Configs found matching {this.Provider ?? "any"} provider");
res.EndRequest();
return;
}
......
}