OData authentication problems

(tobygroves) #1

I’m messing about with the OData support in my Delphi server but I can’t seem to get the authentication to work.

The old documentation wiki says this for the HttpAuthLoginServiceName:

When it’s set, the name used should be the name of a SimpleLoginService descendant with a Login method implementation.

I don’t understand this as the Login method isn’t virtual so how can I override it in a descendant class. If I try then, sure enough, the Login method of my descendant service, specified in the above property, is never called. When I test with LINQPad, I just keep getting 401 Unauthorized errors.

Can anyone give me any pointers?

(EvgenyK) #2

authentication steps:

  • TDAODataSchemaDispatcher.OnLoginNeeded event (if assigned)
  • TDAODataSchemaDispatcher.HttpAuthLoginServiceName.OnLogin event (it was called from Login method)

you can set breakpoint at TDAODataSchemaDispatcher.DoAuthenticate (uDAODataDispatcher.pas) and review what is wrong

(tobygroves) #3

Thanks - I’m probably just being thick but is there an example of this anywhere? I know very little about OData and have just been asked about it by someone else.

(EvgenyK) #4

wizard should create a working ODATA server if correspondent option is set.
you can open http://localhost:8099/odata in browser like IE, FireFox, etc and it will ask for password