parent
e29283799a
commit
38bb428c59
@ -1,16 +1,20 @@
|
|||||||
package cn.teammodel.controller;
|
package cn.teammodel.controller;
|
||||||
|
|
||||||
import cn.teammodel.common.R;
|
import cn.teammodel.common.R;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/")
|
@RequestMapping("/")
|
||||||
public class HelloController {
|
public class HelloController {
|
||||||
|
|
||||||
@GetMapping("hello")
|
@GetMapping("hello")
|
||||||
public R helo() {
|
@PreAuthorize("hasAuthority('IES')")
|
||||||
return new R(200, "sucess","hello world");
|
public R hello() {
|
||||||
|
System.out.println(SecurityContextHolder.getContext().getAuthentication());
|
||||||
|
return new R(200, "success","hello world");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package cn.teammodel.security.filter;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.filter.OncePerRequestFilter;
|
||||||
|
|
||||||
|
import javax.servlet.FilterChain;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* x-auth-authToken filter
|
||||||
|
* @author winter
|
||||||
|
* @create 2023-11-09 10:43
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class AuthInnerTokenFilter extends OncePerRequestFilter {
|
||||||
|
@Override
|
||||||
|
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||||
|
filterChain.doFilter(request, response);
|
||||||
|
}
|
||||||
|
}
|
@ -1 +0,0 @@
|
|||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
spring:
|
||||||
|
cloud:
|
||||||
|
azure:
|
||||||
|
cosmos:
|
||||||
|
endpoint: https://cdhabookdep-free.documents.azure.cn:443
|
||||||
|
database: TEAMModelOS
|
||||||
|
key: v07dMthUjNk8AbwI8698AXHPbXBaaADgtgdYf4sFGXohei6aD2doq6XV45sLMGpDtDDpENAnlGkEUBu9RaAhpg==
|
||||||
|
|
||||||
|
security:
|
||||||
|
oauth2:
|
||||||
|
resourceserver:
|
||||||
|
jwt:
|
||||||
|
issuer-uri: https://login.partner.microsoftonline.cn/4807e9cf-87b8-4174-aa5b-e76497d7392b/v2.0
|
||||||
|
audiences: 72643704-b2e7-4b26-b881-bd5865e7a7a5
|
Loading…
Reference in new issue