ebowman / api-first-hand

API-First bootstrapping tool for building RESTful web services from a Swagger/OpenAPI spec
MIT License
142 stars 22 forks source link

User >: Any In SwaggerSecurityExtractors #71

Open moishy90 opened 7 years ago

moishy90 commented 7 years ago

Hey guys. I was looking through the security templates and code and realized that the security extractors have the type parameters User :> Any. For example def basicAuth[User >: Any]:

I'm wondering: Is this a feature, or is this something that should be fixed?

I'd like to wrap the request with the data generated by the authentication process, through play's play.api.mvc.WrappedRequest with the WrappedRequest's type parameter being the type of the generated data.

moishy90 commented 7 years ago

Ah. I see. You don't pass the request over to the code modified by the user. So it doesn't matter. Whatever data that is needed is passed directly by type to the method changed by the user.

slavaschmidt commented 7 years ago

yeah, we don't pass authentication information to the controller as for now, but there is a ticket for that.

ashmcleod commented 7 years ago

Hi, any news or ETA on this? I would like to get SecurityExtractors information in my controllers. Is there any way to access that info from the controllers. Or maybe getting de request itself?

Wich one is the ticket realted to this?

slavaschmidt commented 7 years ago

@ashmcleod Can't find the ticket, may be I've confused it with comments in the code :) You are welcome to create a ticket for that :)

ashmcleod commented 7 years ago

Hi slavaschmidt,

I think that my request is the same as moishy90's, to be able to get SecurityExtractors generated data in the generated controllers in some way. Do I have to open a new issue for this? or this one may be adecuate?

Is there any way i can get that data modifying de templates?

slavaschmidt commented 7 years ago

Let's leave it here for now. The idea is to get the data obtained by the SecurityExtractor directly into the controller as a parameter. The play.api.mvc.WrappedRequest @moishy90 is talking about is a bit low-level for our approach, I don't have a direct idea how to do this with the API-first approach. It might very well be doable but I can't answer the question right now.