Skip to content

Commit a489a8b

Browse files
the-simmonWeltraumschaf
authored andcommitted
Add user profile endpoint
Signed-off-by: Simon Hülkenberg <simon.huelkenberg@iteratec.com>
1 parent 741f0eb commit a489a8b

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* secureCodeBox (SCB)
3+
* Copyright 2021 iteratec GmbH
4+
* https://www.iteratec.com
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package io.securecodebox.persistence.defectdojo.models;
19+
20+
import com.fasterxml.jackson.annotation.JsonInclude;
21+
import com.fasterxml.jackson.annotation.JsonProperty;
22+
import lombok.*;
23+
24+
import java.util.Map;
25+
26+
@Data
27+
@Builder
28+
@NoArgsConstructor
29+
@AllArgsConstructor
30+
@EqualsAndHashCode(callSuper = true)
31+
@JsonInclude(JsonInclude.Include.NON_NULL)
32+
33+
public class UserProfile extends DefectDojoModel{
34+
35+
@JsonProperty
36+
User user;
37+
38+
@Override
39+
public boolean equalsQueryString(Map<String, Object> queryParams) {
40+
// The user_profile endpoint does not have query parameters thats why this function will just return true
41+
return true;
42+
}
43+
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* secureCodeBox (SCB)
3+
* Copyright 2021 iteratec GmbH
4+
* https://www.iteratec.com
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package io.securecodebox.persistence.defectdojo.service;
19+
20+
import com.fasterxml.jackson.core.JsonProcessingException;
21+
import com.fasterxml.jackson.core.type.TypeReference;
22+
import io.securecodebox.persistence.defectdojo.config.DefectDojoConfig;
23+
import io.securecodebox.persistence.defectdojo.models.DefectDojoResponse;
24+
import io.securecodebox.persistence.defectdojo.models.UserProfile;
25+
26+
public class UserProfileService extends GenericDefectDojoService<UserProfile>{
27+
28+
public UserProfileService(DefectDojoConfig config) {
29+
super(config);
30+
}
31+
32+
@Override
33+
protected String getUrlPath() {
34+
return "user_profile";
35+
}
36+
37+
@Override
38+
protected Class<UserProfile> getModelClass() {
39+
return UserProfile.class;
40+
}
41+
42+
@Override
43+
protected DefectDojoResponse<UserProfile> deserializeList(String response) throws JsonProcessingException {
44+
return this.objectMapper.readValue(response, new TypeReference<>() {});
45+
}
46+
47+
}

0 commit comments

Comments
 (0)