Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: clean up ids-api-multipart-endpoint-v1 #1715

Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
0ef385c
chore: remove IdsResponseMessageFactory
ronjaquensel Jul 8, 2022
d815e25
chore: remove unused exceptions
ronjaquensel Jul 8, 2022
1ab2fc5
chore: merge response and rejection util classes
ronjaquensel Jul 8, 2022
034dc73
chore: remove class IdsClientCredentialsScope
ronjaquensel Jul 11, 2022
42b1156
chore: do not use description sub-handlers
ronjaquensel Jul 11, 2022
6cfd5d7
chore: remove sub-handler classes
ronjaquensel Jul 12, 2022
5f32658
chore: remove DescriptionRequestHandler interface
ronjaquensel Jul 12, 2022
be3c483
chore: remove DescriptionResponseMessageUtil
ronjaquensel Jul 12, 2022
d90f447
chore: move util classes to util package
ronjaquensel Jul 12, 2022
7582399
chore: add token to all response headers
ronjaquensel Jul 12, 2022
fc11082
chore: add Javadoc to MultipartController
ronjaquensel Jul 12, 2022
1896f7b
chore: move method for building description response to util
ronjaquensel Jul 12, 2022
84f70e5
chore: return RequestInProcessMessage for artifact requests
ronjaquensel Jul 12, 2022
20df603
chore: make response depend on status result from state machine
ronjaquensel Jul 12, 2022
eb07868
chore: do not build message in ArtifactRequestHandler
ronjaquensel Jul 12, 2022
7a05a51
chore: rename DescriptionRequestHandler
ronjaquensel Jul 13, 2022
761f359
chore: align parameter order in ResponseMessageUtil
ronjaquensel Jul 13, 2022
4786e6b
docs: add Javadoc for ResponseMessageUtil
ronjaquensel Jul 13, 2022
5d6651c
chore: remove unused method
ronjaquensel Jul 13, 2022
1344b2d
docs: add Javadoc for MultipartResponseUtil
ronjaquensel Jul 13, 2022
4db8bf7
refactor: remove duplicated methods from handlers
ronjaquensel Jul 18, 2022
83f5e59
refactor: remove MultipartResponseUtil
ronjaquensel Jul 18, 2022
0dad8e2
refactor: process status result in contract handlers
ronjaquensel Jul 18, 2022
62b30c8
refactor: remove notification sub-handlers
ronjaquensel Jul 18, 2022
39fb36c
chore: remove check for connector payload in MultipartController
ronjaquensel Jul 18, 2022
755e5d7
refactor: remove superfluous claim token parameter
ronjaquensel Jul 18, 2022
a61cdf9
refactor: remove internal handle method from DescriptionRequestHandler
ronjaquensel Jul 18, 2022
dea5fcf
docs: add comments and Javadoc
ronjaquensel Jul 19, 2022
199ff97
refactor: make handleRequest in Handler @NotNull
ronjaquensel Jul 19, 2022
0a0b08f
chore: change rejection reason in EDR handler
ronjaquensel Jul 19, 2022
39a9d1d
chore: add required fields to test messages
ronjaquensel Jul 19, 2022
24b2045
test: update handler tests
ronjaquensel Jul 19, 2022
96697d2
test: replace tests for DescriptionRequestHandler
ronjaquensel Jul 19, 2022
2dbcbea
refactor: rename RequestUtil
ronjaquensel Jul 20, 2022
fd28727
chore: only store secret if TP initialized successfully
ronjaquensel Jul 20, 2022
118d3f0
docs: update CHANGELOG.md
ronjaquensel Jul 20, 2022
833f521
test: update ResponseUtilTest
ronjaquensel Jul 20, 2022
189ede4
chore: fix import order
ronjaquensel Jul 20, 2022
ec60ced
chore: fix import order
ronjaquensel Jul 20, 2022
818269e
refactor: return FormDataMultiPart from MultipartController
ronjaquensel Jul 20, 2022
cb3fe43
refactor: return token from method in MultipartController
ronjaquensel Jul 20, 2022
48103c3
chore: remove unused contract offer handler
ronjaquensel Jul 20, 2022
95f3634
chore: remove superfluous requireNonNull checks
ronjaquensel Jul 20, 2022
7f4dfa7
refactor: inject monitor into IdsMultipartApiServiceExtension
ronjaquensel Jul 22, 2022
d7cbdd5
chore: add TODOs for after project structure review
ronjaquensel Jul 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: return token from method in MultipartController
  • Loading branch information
ronjaquensel committed Jul 20, 2022
commit cb3fe434928d70e14c1df2ed042be3dcbf282c6d
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import de.fraunhofer.iais.eis.DynamicAttributeToken;
import de.fraunhofer.iais.eis.DynamicAttributeTokenBuilder;
import de.fraunhofer.iais.eis.Message;
import de.fraunhofer.iais.eis.TokenFormat;
@@ -165,7 +166,7 @@ public FormDataMultiPart request(@FormDataParam(HEADER) InputStream headerInputS
* @return a multipart body.
*/
private FormDataMultiPart buildMultipart(MultipartResponse multipartResponse) {
addTokenToResponseHeader(multipartResponse.getHeader());
multipartResponse.getHeader().setSecurityToken(getToken(multipartResponse.getHeader()));
return createFormDataMultiPart(multipartResponse.getHeader(), multipartResponse.getPayload());
}

@@ -177,7 +178,7 @@ private FormDataMultiPart buildMultipart(MultipartResponse multipartResponse) {
* @return a multipart body.
*/
private FormDataMultiPart buildMultipart(Message header) {
addTokenToResponseHeader(header);
header.setSecurityToken(getToken(header));
return createFormDataMultiPart(header, null);
}

@@ -202,11 +203,11 @@ private FormDataMultiPart createFormDataMultiPart(Message header, Object payload
}

/**
* Retrieves an identity token and adds it to the given message.
* Retrieves an identity token for the given message.
*
* @param header the message.
*/
private void addTokenToResponseHeader(Message header) {
private DynamicAttributeToken getToken(Message header) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a method that may be also needed by the MultipartSender classes? As the sender needs a DAT, too. Maybe this could be in a utils oder MessageFunctions class in ids-core.message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. I stumbled over other duplications as well, e.g. the resolveConnectorId method in both extension classes. Probably moving all these to ids-core would be something for another PR, to restrict this one to the endpoint module, but I'll open an issue.

var tokenBuilder = new DynamicAttributeTokenBuilder()
._tokenFormat_(TokenFormat.JWT);

@@ -222,7 +223,7 @@ private void addTokenToResponseHeader(Message header) {
tokenBuilder._tokenValue_("invalid");
}

header.setSecurityToken(tokenBuilder.build());
return tokenBuilder.build();
}

private byte[] toJson(Object object) {