rest

How to send password securely from client side? [closed]

社会主义新天地 提交于 2021-02-05 07:17:05
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . Improve this question I'm trying to make my REST API more secure. For the moment I'm hashing my password in my angular app with CryptoJs.SHA256 before sending it to my C# backend. But I realize it's better to hash password on server side. So how can I send a password only readable

Java - How to make JSON date validation?

寵の児 提交于 2021-02-05 06:05:51
问题 I have this piece of code: @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") protected Date statusDate; But for somehow it accepts date formats like - "statusDate": "2017-13-27" or "statusDate": "201823-12-12" Is it possible to validate the format within the request (not manually)? 回答1: Well, you need to write a custom date serialisation/de-serialisation class and throw a custom exception if the date format you receive while intercepting the data is not what you'd expected.

Java - How to make JSON date validation?

霸气de小男生 提交于 2021-02-05 06:04:30
问题 I have this piece of code: @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") protected Date statusDate; But for somehow it accepts date formats like - "statusDate": "2017-13-27" or "statusDate": "201823-12-12" Is it possible to validate the format within the request (not manually)? 回答1: Well, you need to write a custom date serialisation/de-serialisation class and throw a custom exception if the date format you receive while intercepting the data is not what you'd expected.

JWT and one-time tokens?

大城市里の小女人 提交于 2021-02-05 05:24:25
问题 I'm in the process of rolling my own JWT token auth, however, I would really like it to be a one time-token – so once it's used, the server generates a new token and the client will have to use that token during the next request/call. However, it has come to my understanding that JWT is supposed to be 'stateless' – but with the approach of a one time token, I guess I would need to somehow store the valid tokens, since the token will be refreshed once it's used. Or is there any way to avoid

How to retrieve entity relationships after save?

一个人想着一个人 提交于 2021-02-05 03:24:27
问题 I'm developing a RESTful webservice with spring-data as its data access layer, backed by JPA/Hibernate. It is very common to have relationships between domain entities. For example, imagine an entity Product which has a Category entity. Now, when the client POST s a Product representation to a JAX-RS method. That method is annotated with @Transactional to wrap every repository operation in a transaction. Of course, the client only sends the id of an already existing Category , not the whole

How to retrieve entity relationships after save?

柔情痞子 提交于 2021-02-05 03:23:01
问题 I'm developing a RESTful webservice with spring-data as its data access layer, backed by JPA/Hibernate. It is very common to have relationships between domain entities. For example, imagine an entity Product which has a Category entity. Now, when the client POST s a Product representation to a JAX-RS method. That method is annotated with @Transactional to wrap every repository operation in a transaction. Of course, the client only sends the id of an already existing Category , not the whole

How to retrieve entity relationships after save?

感情迁移 提交于 2021-02-05 03:21:07
问题 I'm developing a RESTful webservice with spring-data as its data access layer, backed by JPA/Hibernate. It is very common to have relationships between domain entities. For example, imagine an entity Product which has a Category entity. Now, when the client POST s a Product representation to a JAX-RS method. That method is annotated with @Transactional to wrap every repository operation in a transaction. Of course, the client only sends the id of an already existing Category , not the whole

What is the format of the JSON for a Jenkins REST buildWithParameters to override the default parameters values

∥☆過路亽.° 提交于 2021-02-05 00:23:12
问题 I am able to build a Jenkins job with its parameters' default values by sending a POST call to http://jenkins:8080/view/Orion_phase_2/job/test_remote_api_triggerring/buildWithParameters and I can override the default parameters "product", "suites" and "markers by sending to this URL: http://jenkins:8080/view/Orion_phase_2/job/test_remote_api_triggerring/buildWithParameters?product=ALL&suites=ALL&markers=ALL But I saw examples were the parameters can be override by sending a JSON body with new

What is the format of the JSON for a Jenkins REST buildWithParameters to override the default parameters values

穿精又带淫゛_ 提交于 2021-02-05 00:20:51
问题 I am able to build a Jenkins job with its parameters' default values by sending a POST call to http://jenkins:8080/view/Orion_phase_2/job/test_remote_api_triggerring/buildWithParameters and I can override the default parameters "product", "suites" and "markers by sending to this URL: http://jenkins:8080/view/Orion_phase_2/job/test_remote_api_triggerring/buildWithParameters?product=ALL&suites=ALL&markers=ALL But I saw examples were the parameters can be override by sending a JSON body with new

Express.js Handle unmached routes

一曲冷凌霜 提交于 2021-02-04 19:58:19
问题 Fellows I develop a Rest API and I want when a route does not exist to send a custom message instead of an html one that express.js sends by default. As fas as I searched I could not find a way to do that. I tried to do: app.all("*",function(req,res){ res.status(404) res.header("Content Type","application/json") res.end(JSON.stringify({message:"Route not found"})) }); But it matches and all already implemented methods. I want only the unmached one to get handled by my app. Edit 1 For each