-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5eb2a4c
commit dae7dce
Showing
7 changed files
with
130 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package handlers | ||
|
||
import ( | ||
"net/http" | ||
"soarca-gui/auth" | ||
"soarca-gui/utils" | ||
|
||
authviews "soarca-gui/views/auth" | ||
|
||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
type OIDCAuthHandler struct { | ||
authenticator *auth.Authenticator | ||
} | ||
|
||
func NewOIDCAuthHanlder(authenticator *auth.Authenticator) *OIDCAuthHandler { | ||
return &OIDCAuthHandler{authenticator: authenticator} | ||
} | ||
|
||
func (a *OIDCAuthHandler) OIDCAuthPageHandler(context *gin.Context) { | ||
render := utils.NewTempl(context, http.StatusOK, authviews.OIDCLoginIndex()) | ||
context.Render(http.StatusOK, render) | ||
} | ||
|
||
func (a *OIDCAuthHandler) OIDCLoginHandler(context *gin.Context) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package authviews | ||
|
||
import ( | ||
"soarca-gui/views/layouts" | ||
) | ||
|
||
|
||
templ OIDCLoginIndex() { | ||
@OIDCLoginBaseLayout() { | ||
@OIDCLoginForm() | ||
} | ||
} | ||
|
||
templ OIDCLoginBaseLayout() { | ||
@layouts.BaseLayout() { | ||
<body class="min-h-screen bg-gray-100 dark:bg-slate-800 flex flex-col justify-center sm:py-12 font-family-sans-serif"> | ||
<div class="p-10 xs:p-0 mx-auto md:w-full md:max-w-md"> | ||
<a href={ templ.URL(homeLink) } class="text-white text-3xl font-semibold uppercase hover:text-gray-300"> | ||
<img src={ soarcaLogoUrlPath } class="w-30 py-3 md:py-0 g-image"/> | ||
</a> | ||
<div class="bg-white shadow w-full rounded-lg divide-y divide-gray-200"> | ||
<div id="extra-information" class="px-5 py-7"> | ||
// will be filled when error message | ||
</div> | ||
<div class="bg-white shadow w-full rounded-lg divide-y divide-gray-200"> | ||
{ children... } | ||
</div> | ||
<div class="py-5"> | ||
<div class="grid grid-cols-2 gap-1"> | ||
<div class="text-center sm:text-left whitespace-nowrap"> | ||
<button class="transition duration-200 mx-5 px-5 py-4 cursor-pointer font-normal text-sm rounded-lg text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-200 focus:ring-2 focus:ring-gray-400 focus:ring-opacity-50 ring-inset"> | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="w-4 h-4 inline-block align-text-top"> | ||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"></path> | ||
</svg> | ||
<span class="inline-block ml-1">Forgot Password</span> | ||
</button> | ||
</div> | ||
<div class="text-center sm:text-right whitespace-nowrap"> | ||
<button class="transition duration-200 mx-5 px-5 py-4 cursor-pointer font-normal text-sm rounded-lg text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-200 focus:ring-2 focus:ring-gray-400 focus:ring-opacity-50 ring-inset"> | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="w-4 h-4 inline-block align-text-bottom "> | ||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192l-3.536 3.536M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-5 0a4 4 0 11-8 0 4 4 0 018 0z"></path> | ||
</svg> | ||
<span class="inline-block ml-1">Help</span> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
} | ||
} | ||
|
||
|
||
templ OIDCLoginForm() { | ||
<div class="px-5 py-7"> | ||
<button | ||
hx-get="/oidc-login" | ||
class="transition duration-200 bg-blue-500 hover:bg-blue-600 focus:bg-blue-700 focus:shadow-sm focus:ring-4 focus:ring-blue-500 focus:ring-opacity-50 text-white w-full py-2.5 rounded-lg text-sm shadow-sm hover:shadow-md font-semibold text-center inline-block" | ||
> | ||
<span class="inline-block mr-2">Login with OIDC</span> | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="w-4 h-4 inline-block"> | ||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1"></path> | ||
</svg> | ||
</button> | ||
</div> | ||
} | ||
|