Updated CORS
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
package com.mattrixwv.cipherstream.config;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@EnableWebMvc
|
||||||
|
public class WebConfig implements WebMvcConfigurer{
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(@NonNull CorsRegistry registry){
|
||||||
|
registry.addMapping("/**")
|
||||||
|
.allowedOriginPatterns("http://localhost:3000");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.mattrixwv.cipherstream.controller.monosubstitution;
|
|||||||
|
|
||||||
import org.slf4j.MDC;
|
import org.slf4j.MDC;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -29,7 +30,7 @@ public class CaesarCipherController{
|
|||||||
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.CAESAR_CIPHER_NAME, CipherInfoUtil.CAESAR_CIPHER_DESCRIPTION);
|
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.CAESAR_CIPHER_NAME, CipherInfoUtil.CAESAR_CIPHER_DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/encode")
|
@PostMapping("/encode")
|
||||||
public ObjectNode encodeCaesar(@RequestBody ObjectNode cipherParams){
|
public ObjectNode encodeCaesar(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.CAESAR_CIPHER_NAME);
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.CAESAR_CIPHER_NAME);
|
||||||
log.info("Encoding {}", CipherInfoUtil.CAESAR_CIPHER_NAME);
|
log.info("Encoding {}", CipherInfoUtil.CAESAR_CIPHER_NAME);
|
||||||
@@ -52,7 +53,7 @@ public class CaesarCipherController{
|
|||||||
return cipherParams;
|
return cipherParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/decode")
|
@PostMapping("/decode")
|
||||||
public ObjectNode decodeCaesar(@RequestBody ObjectNode cipherParams){
|
public ObjectNode decodeCaesar(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.CAESAR_CIPHER_NAME);
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.CAESAR_CIPHER_NAME);
|
||||||
log.info("Decoding {}", CipherInfoUtil.CAESAR_CIPHER_NAME);
|
log.info("Decoding {}", CipherInfoUtil.CAESAR_CIPHER_NAME);
|
||||||
|
|||||||
Reference in New Issue
Block a user