mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-08-05 12:56:48 +02:00
@@ -44,7 +44,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
/* Build Constants */
|
/* Build Constants */
|
||||||
SYSTEM_NAME = "Zoraxy"
|
SYSTEM_NAME = "Zoraxy"
|
||||||
SYSTEM_VERSION = "3.2.3"
|
SYSTEM_VERSION = "3.2.4"
|
||||||
DEVELOPMENT_BUILD = false
|
DEVELOPMENT_BUILD = false
|
||||||
|
|
||||||
/* System Constants */
|
/* System Constants */
|
||||||
|
@@ -4,13 +4,14 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
"imuslab.com/zoraxy/mod/database"
|
"imuslab.com/zoraxy/mod/database"
|
||||||
"imuslab.com/zoraxy/mod/info/logger"
|
"imuslab.com/zoraxy/mod/info/logger"
|
||||||
"imuslab.com/zoraxy/mod/utils"
|
"imuslab.com/zoraxy/mod/utils"
|
||||||
"net/http"
|
|
||||||
"net/url"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type OAuth2RouterOptions struct {
|
type OAuth2RouterOptions struct {
|
||||||
@@ -250,7 +251,19 @@ func (ar *OAuth2Router) HandleOAuth2Auth(w http.ResponseWriter, r *http.Request)
|
|||||||
cookie.SameSite = http.SameSiteLaxMode
|
cookie.SameSite = http.SameSiteLaxMode
|
||||||
}
|
}
|
||||||
w.Header().Add("Set-Cookie", cookie.String())
|
w.Header().Add("Set-Cookie", cookie.String())
|
||||||
http.Redirect(w, r, state, http.StatusTemporaryRedirect)
|
|
||||||
|
//Fix for #695
|
||||||
|
location := strings.TrimPrefix(state, "/internal/")
|
||||||
|
//Check if the location starts with http:// or https://. if yes, this is full URL
|
||||||
|
decodedLocation, err := url.PathUnescape(location)
|
||||||
|
if err == nil && (strings.HasPrefix(decodedLocation, "http://") || strings.HasPrefix(decodedLocation, "https://")) {
|
||||||
|
//Redirect to the full URL
|
||||||
|
http.Redirect(w, r, decodedLocation, http.StatusTemporaryRedirect)
|
||||||
|
} else {
|
||||||
|
//Redirect to a relative path
|
||||||
|
http.Redirect(w, r, state, http.StatusTemporaryRedirect)
|
||||||
|
}
|
||||||
|
|
||||||
return errors.New("authorized")
|
return errors.New("authorized")
|
||||||
}
|
}
|
||||||
unauthorized := false
|
unauthorized := false
|
||||||
|
@@ -90,8 +90,8 @@ func (c *ProxyRelayConfig) ForwardUDP(address1, address2 string, stopChan chan b
|
|||||||
address1 = ":" + address1
|
address1 = ":" + address1
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(address1, ":") {
|
if strings.HasPrefix(address1, ":") {
|
||||||
//Prepend 127.0.0.1 to the address
|
//Prepend 0.0.0.0 to the address
|
||||||
address1 = "127.0.0.1" + address1
|
address1 = "0.0.0.0" + address1
|
||||||
}
|
}
|
||||||
|
|
||||||
lisener, targetAddr, err := initUDPConnections(address1, address2)
|
lisener, targetAddr, err := initUDPConnections(address1, address2)
|
||||||
|
@@ -3,18 +3,15 @@
|
|||||||
<h2>SSO</h2>
|
<h2>SSO</h2>
|
||||||
<p>Single Sign-On (SSO) and authentication providers settings </p>
|
<p>Single Sign-On (SSO) and authentication providers settings </p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui basic segment">
|
|
||||||
<div class="ui yellow message">
|
|
||||||
<div class="header">
|
|
||||||
Experimental Feature
|
|
||||||
</div>
|
|
||||||
<p>Please note that this feature is still in development and may not work as expected.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
<div class="ui basic segment">
|
<div class="ui top attached tabular menu ssoTabs">
|
||||||
<h3>Forward Auth</h3>
|
<a class="item active" data-tab="forward_auth_tab">Forward Auth</a>
|
||||||
|
<a class="item" data-tab="oauth2_tab">Oauth2</a>
|
||||||
|
<!-- <a class="item" data-tab="zoraxy_sso_tab">Zoraxy SSO</a> -->
|
||||||
|
</div>
|
||||||
|
<div class="ui bottom attached tab segment active" data-tab="forward_auth_tab">
|
||||||
|
<!-- Forward Auth -->
|
||||||
|
<h2>Forward Auth</h2>
|
||||||
<p>Configuration settings for the Forward Auth provider.</p>
|
<p>Configuration settings for the Forward Auth provider.</p>
|
||||||
<p>The Forward Auth provider makes a subrequest to an authorization server that supports Forward Auth, then either:</p>
|
<p>The Forward Auth provider makes a subrequest to an authorization server that supports Forward Auth, then either:</p>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -86,10 +83,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<button class="ui basic button" type="submit"><i class="green check icon"></i> Apply Change</button>
|
<button class="ui basic button" type="submit"><i class="green check icon"></i> Apply Change</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui divider"></div>
|
<div class="ui bottom attached tab segment" data-tab="oauth2_tab">
|
||||||
<div class="ui basic segment">
|
<!-- Oauth 2 -->
|
||||||
<h3>OAuth 2.0</h3>
|
<h2>OAuth 2.0</h2>
|
||||||
<p>Configuration settings for OAuth 2.0 authentication provider.</p>
|
<p>Configuration settings for OAuth 2.0 authentication provider.</p>
|
||||||
|
|
||||||
<form class="ui form" action="#" id="oauth2Settings">
|
<form class="ui form" action="#" id="oauth2Settings">
|
||||||
@@ -134,11 +131,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<button class="ui basic button" type="submit"><i class="green check icon"></i> Apply Change</button>
|
<button class="ui basic button" type="submit"><i class="green check icon"></i> Apply Change</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui divider"></div>
|
<div class="ui bottom attached tab segment" data-tab="zoraxy_sso_tab">
|
||||||
|
<!-- Zoraxy SSO -->
|
||||||
|
<h3>Zoraxy SSO</h3>
|
||||||
|
<p>Configuration settings for Zoraxy SSO provider.</p>
|
||||||
|
<p>Currently not implemented.</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(".ssoTabs .item").tab();
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
/* Load forward-auth settings from backend */
|
/* Load forward-auth settings from backend */
|
||||||
$.cjax({
|
$.cjax({
|
||||||
|
Reference in New Issue
Block a user