Be consistent with annotations
This commit is contained in:
@@ -32,6 +32,8 @@ import io.kamax.mxisd.key.KeyManager
|
|||||||
import org.slf4j.Logger
|
import org.slf4j.Logger
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
|
import org.springframework.http.MediaType
|
||||||
|
import org.springframework.web.bind.annotation.CrossOrigin
|
||||||
import org.springframework.web.bind.annotation.RequestMapping
|
import org.springframework.web.bind.annotation.RequestMapping
|
||||||
import org.springframework.web.bind.annotation.RequestParam
|
import org.springframework.web.bind.annotation.RequestParam
|
||||||
import org.springframework.web.bind.annotation.RestController
|
import org.springframework.web.bind.annotation.RestController
|
||||||
@@ -41,6 +43,8 @@ import javax.servlet.http.HttpServletRequest
|
|||||||
import static org.springframework.web.bind.annotation.RequestMethod.POST
|
import static org.springframework.web.bind.annotation.RequestMethod.POST
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@CrossOrigin
|
||||||
|
@RequestMapping(path = "/_matrix/identity/api/v1", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
class InvitationController {
|
class InvitationController {
|
||||||
|
|
||||||
private Logger log = LoggerFactory.getLogger(InvitationController.class)
|
private Logger log = LoggerFactory.getLogger(InvitationController.class)
|
||||||
@@ -56,7 +60,7 @@ class InvitationController {
|
|||||||
|
|
||||||
private Gson gson = new Gson()
|
private Gson gson = new Gson()
|
||||||
|
|
||||||
@RequestMapping(value = "/_matrix/identity/api/v1/store-invite", method = POST)
|
@RequestMapping(value = "/store-invite", method = POST)
|
||||||
String store(
|
String store(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
@RequestParam String sender,
|
@RequestParam String sender,
|
||||||
|
@@ -28,16 +28,16 @@ import org.apache.commons.lang.StringUtils
|
|||||||
import org.slf4j.Logger
|
import org.slf4j.Logger
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.web.bind.annotation.PathVariable
|
import org.springframework.http.MediaType
|
||||||
import org.springframework.web.bind.annotation.RequestMapping
|
import org.springframework.web.bind.annotation.*
|
||||||
import org.springframework.web.bind.annotation.RequestParam
|
|
||||||
import org.springframework.web.bind.annotation.RestController
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest
|
import javax.servlet.http.HttpServletRequest
|
||||||
|
|
||||||
import static org.springframework.web.bind.annotation.RequestMethod.GET
|
import static org.springframework.web.bind.annotation.RequestMethod.GET
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@CrossOrigin
|
||||||
|
@RequestMapping(path = "/_matrix/identity/api/v1", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
class KeyController {
|
class KeyController {
|
||||||
|
|
||||||
private Logger log = LoggerFactory.getLogger(KeyController.class)
|
private Logger log = LoggerFactory.getLogger(KeyController.class)
|
||||||
@@ -45,7 +45,7 @@ class KeyController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private KeyManager keyMgr
|
private KeyManager keyMgr
|
||||||
|
|
||||||
@RequestMapping(value = "/_matrix/identity/api/v1/pubkey/{keyType}:{keyId}", method = GET)
|
@RequestMapping(value = "/pubkey/{keyType}:{keyId}", method = GET)
|
||||||
String getKey(@PathVariable String keyType, @PathVariable int keyId) {
|
String getKey(@PathVariable String keyType, @PathVariable int keyId) {
|
||||||
if (!"ed25519".contentEquals(keyType)) {
|
if (!"ed25519".contentEquals(keyType)) {
|
||||||
throw new BadRequestException("Invalid algorithm: " + keyType)
|
throw new BadRequestException("Invalid algorithm: " + keyType)
|
||||||
@@ -57,14 +57,14 @@ class KeyController {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/_matrix/identity/api/v1/pubkey/ephemeral/isvalid", method = GET)
|
@RequestMapping(value = "/pubkey/ephemeral/isvalid", method = GET)
|
||||||
String checkEphemeralKeyValidity(HttpServletRequest request) {
|
String checkEphemeralKeyValidity(HttpServletRequest request) {
|
||||||
log.error("{} was requested but not implemented", request.getRequestURL())
|
log.error("{} was requested but not implemented", request.getRequestURL())
|
||||||
|
|
||||||
throw new NotImplementedException()
|
throw new NotImplementedException()
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/_matrix/identity/api/v1/pubkey/isvalid", method = GET)
|
@RequestMapping(value = "/pubkey/isvalid", method = GET)
|
||||||
String checkKeyValidity(HttpServletRequest request, @RequestParam("public_key") String pubKey) {
|
String checkKeyValidity(HttpServletRequest request, @RequestParam("public_key") String pubKey) {
|
||||||
log.info("Validating public key {}", pubKey)
|
log.info("Validating public key {}", pubKey)
|
||||||
|
|
||||||
|
@@ -33,16 +33,16 @@ import org.apache.http.HttpStatus
|
|||||||
import org.slf4j.Logger
|
import org.slf4j.Logger
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.web.bind.annotation.PathVariable
|
import org.springframework.http.MediaType
|
||||||
import org.springframework.web.bind.annotation.RequestMapping
|
import org.springframework.web.bind.annotation.*
|
||||||
import org.springframework.web.bind.annotation.RequestParam
|
|
||||||
import org.springframework.web.bind.annotation.RestController
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest
|
import javax.servlet.http.HttpServletRequest
|
||||||
import javax.servlet.http.HttpServletResponse
|
import javax.servlet.http.HttpServletResponse
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@CrossOrigin
|
||||||
|
@RequestMapping(path = "/_matrix/identity/api/v1", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
class SessionController {
|
class SessionController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -56,7 +56,7 @@ class SessionController {
|
|||||||
gson.fromJson(new InputStreamReader(req.getInputStream(), StandardCharsets.UTF_8), obj)
|
gson.fromJson(new InputStreamReader(req.getInputStream(), StandardCharsets.UTF_8), obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/_matrix/identity/api/v1/validate/{medium}/requestToken")
|
@RequestMapping(value = "/validate/{medium}/requestToken")
|
||||||
String init(HttpServletRequest request, HttpServletResponse response, @PathVariable String medium) {
|
String init(HttpServletRequest request, HttpServletResponse response, @PathVariable String medium) {
|
||||||
log.info("Requested: {}", request.getRequestURL(), request.getQueryString())
|
log.info("Requested: {}", request.getRequestURL(), request.getQueryString())
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ class SessionController {
|
|||||||
return gson.toJson(obj)
|
return gson.toJson(obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/_matrix/identity/api/v1/validate/{medium}/submitToken")
|
@RequestMapping(value = "/validate/{medium}/submitToken")
|
||||||
String validate(HttpServletRequest request,
|
String validate(HttpServletRequest request,
|
||||||
@RequestParam String sid,
|
@RequestParam String sid,
|
||||||
@RequestParam("client_secret") String secret, @RequestParam String token) {
|
@RequestParam("client_secret") String secret, @RequestParam String token) {
|
||||||
@@ -88,7 +88,7 @@ class SessionController {
|
|||||||
return "{}"
|
return "{}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/_matrix/identity/api/v1/3pid/getValidated3pid")
|
@RequestMapping(value = "/3pid/getValidated3pid")
|
||||||
String check(HttpServletRequest request, HttpServletResponse response,
|
String check(HttpServletRequest request, HttpServletResponse response,
|
||||||
@RequestParam String sid, @RequestParam("client_secret") String secret) {
|
@RequestParam String sid, @RequestParam("client_secret") String secret) {
|
||||||
log.info("Requested: {}?{}", request.getRequestURL(), request.getQueryString())
|
log.info("Requested: {}?{}", request.getRequestURL(), request.getQueryString())
|
||||||
@@ -115,7 +115,7 @@ class SessionController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/_matrix/identity/api/v1/3pid/bind")
|
@RequestMapping(value = "/3pid/bind")
|
||||||
String bind(HttpServletRequest request, HttpServletResponse response,
|
String bind(HttpServletRequest request, HttpServletResponse response,
|
||||||
@RequestParam String sid, @RequestParam("client_secret") String secret, @RequestParam String mxid) {
|
@RequestParam String sid, @RequestParam("client_secret") String secret, @RequestParam String mxid) {
|
||||||
String data = IOUtils.toString(request.getReader())
|
String data = IOUtils.toString(request.getReader())
|
||||||
|
Reference in New Issue
Block a user