Class AuthnHttpEndpoint

java.lang.Object
io.github.xezzon.zeroweb.auth.internal.AuthnHttpEndpoint

@RequestMapping("/auth") @RestController public class AuthnHttpEndpoint extends Object
认证
Author:
xezzon
  • Constructor Details

    • AuthnHttpEndpoint

      public AuthnHttpEndpoint(AuthnService authnService, io.github.xezzon.zeroweb.common.config.ZerowebConfig zerowebConfig)
      构造函数,注入 AuthnServiceZerowebConfig
      Parameters:
      authnService - 认证服务实例。
      zerowebConfig - ZeroWeb 配置实例。
  • Method Details

    • basicLogin

      @PostMapping("/login/basic") public OidcToken basicLogin(@RequestBody @Valid @Valid BasicAuth basicAuth)
      通过用户名和密码进行基本认证登录。
      Parameters:
      basicAuth - 包含用户名和密码的 BasicAuth 请求体。
      Returns:
      包含访问令牌、ID 令牌和过期时间的 OidcToken 对象。
    • self

      @GetMapping("/self") public org.springframework.http.ResponseEntity<byte @NonNull []> self() throws com.google.protobuf.InvalidProtocolBufferException

      获取当前用户的认证信息。

      如果用户未登录,返回 204 No Content。

      Returns:
      包含用户认证信息(JWT)的 ResponseEntity
      Throws:
      com.google.protobuf.InvalidProtocolBufferException - 如果 JWT Claim 无法正确序列化。
    • getSsoToken

      @GetMapping("/token") public OidcToken getSsoToken(jakarta.servlet.http.HttpServletResponse response)

      获取当前用户的 SSO 令牌。

      需要用户已登录。

      Parameters:
      response - HttpServletResponse 用于设置响应头。
      Returns:
      包含访问令牌、ID 令牌和过期时间的 OidcToken 对象。