25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

73 satır
1.9KB

  1. <%
  2. Class AuthController_Class
  3. Private m_useLayout
  4. Private m_title
  5. Private Sub Class_Initialize()
  6. m_useLayout = True
  7. m_title = "Authentication"
  8. End Sub
  9. Public Property Get useLayout
  10. useLayout = m_useLayout
  11. End Property
  12. Public Property Let useLayout(v)
  13. m_useLayout = v
  14. End Property
  15. Public Property Get Title
  16. Title = m_title
  17. End Property
  18. Public Property Let Title(v)
  19. m_title = v
  20. End Property
  21. ' GET /auth/login
  22. ' Initiates the Keycloak authorization-code flow. Generates state/nonce,
  23. ' stores them in Session, then redirects the browser to Keycloak.
  24. Public Sub Login()
  25. Dim returnToPath
  26. returnToPath = Trim(CStr(Request.QueryString("returnTo")))
  27. If Len(returnToPath) > 0 Then
  28. Call KeycloakSetPostLoginRedirectPath(returnToPath)
  29. End If
  30. Call KeycloakLogin()
  31. End Sub
  32. ' GET /auth/callback
  33. ' Keycloak redirects here after the user authenticates. Exchanges the
  34. ' authorization code for tokens, fetches user info, and redirects home.
  35. ' On failure the error view is rendered inline.
  36. Public Sub Callback()
  37. Dim success, redirectPath
  38. success = KeycloakHandleCallback()
  39. If success Then
  40. redirectPath = KeycloakConsumePostLoginRedirectPath("/")
  41. Response.Redirect redirectPath
  42. Else
  43. %>
  44. <!--#include file="../views/Auth/CallbackError.asp" -->
  45. <%
  46. End If
  47. End Sub
  48. ' GET /auth/logout
  49. ' Clears the local session and redirects to Keycloak's logout endpoint so
  50. ' the SSO session is also terminated.
  51. Public Sub Logout()
  52. Call KeycloakLogout("")
  53. End Sub
  54. End Class
  55. Dim AuthController_Class__Singleton
  56. Function AuthController()
  57. If IsEmpty(AuthController_Class__Singleton) Then
  58. Set AuthController_Class__Singleton = New AuthController_Class
  59. End If
  60. Set AuthController = AuthController_Class__Singleton
  61. End Function
  62. %>

Powered by TurnKey Linux.