通过 HttpAuthenticationMechanism 执行 Web 身份验证:测验答案

测试您的知识

返回到通过 HttpAuthenticationMechanism 执行 Web 身份验证

  1. 3 种默认的 HttpAuthenticationMechanism 实现是哪些?
    1. @BasicFormAuthenticationMechanismDefinition
    2. @FormAuthenticationMechanismDefinition
    3. @LoginFormAuthenticationMechanismDefinition
    4. @CustomFormAuthenticationMechanismDefinition
    5. @BasicAuthenticationMechanismDefinition
    答案:b、c、e
  2. 以下哪两种注解会触发基于表单的身份验证?
    1. @BasicAuthenticationMechanismDefinition
    2. @BasicFormAuthenticationMechanismDefinition
    3. @FormAuthenticationMechanismDefinition
    4. @FormBasedAuthenticationMechanismDefinition
    5. @CustomFormAuthenticationMechanismDefinition

    答案:c、e

  3. 以下哪两种配置是基本身份验证的有效配置?
    1. @BasicAuthenticationMechanismDefinition(realmName="user-realm")
    2. @BasicAuthenticationMechanismDefinition(userRealm="user-realm")
    3. @BasicAuthenticationMechanismDefinition(loginToContinue = @LoginToContinue)
    4. @BasicAuthenticationMechanismDefinition
    5. @BasicAuthenticationMechanismDefinition(realm="user-realm")
    答案:a、d
  4. 以下哪三种配置是基于表单的身份验证的有效配置?
    1. @FormAuthenticationMechanismDefinition(loginToContinue = @LoginToContinue)
    2. @FormAuthenticationMechanismDefinition
    3. @FormBasedAuthenticationMechanismDefinition
    4. @FormAuthenticationMechanismDefinition(loginToContinue = @LoginToContinue(useForwardToLoginExpression = "${appConfigs.forward}"))
    5. @FormBasedAuthenticationMechanismDefinition(loginToContinue = @LoginToContinue)
    答案:a、b、d
  5. 在 HTTP 请求期间,应在 HttpAuthenticationMechanismFilterHttpServlet 实现上按何种顺序调用方法?
    1. doFilter()validateRequest()service()secureResponse()
    2. validateRequest()doFilter()secureResponse()service()
    3. validateRequest()service()doFilter()secureResponse()
    4. validateRequest()doFilter()service()secureResponse()
    5. service()secureResponse()doFilter()validateRequest()
    答案:d
  6. 您如何设置 RememberMe cookie 的最大寿命?
    1. @RememberMe(cookieMaxAge = (units = SECONDS, value = 3600)
    2. @RememberMe(maxAgeSeconds = 3600)
    3. @RememberMe(cookieMaxAgeSeconds = 3600)
    4. @RememberMe(cookieMaxAgeMilliseconds = 3600000)
    5. @RememberMe(cookieMaxAgeSeconds = "3600")
    答案:c

返回到通过 HttpAuthenticationMechanism 执行 Web 身份验证