mirror of
https://wiilab.wiimart.org/wiimart/WiiSOAP
synced 2025-11-07 07:50:02 +01:00
Allow no authentication
Only when debugging is enabled. Allows skipping of authentication for usage with CAS and so forth.
This commit is contained in:
parent
8291cff180
commit
dad74c7f82
@ -16,4 +16,8 @@
|
|||||||
<!-- Set to true to enable response debugging.
|
<!-- Set to true to enable response debugging.
|
||||||
Can be extremely verbose. -->
|
Can be extremely verbose. -->
|
||||||
<Debug>true</Debug>
|
<Debug>true</Debug>
|
||||||
|
<!-- Set to true to ignore authentication checks.
|
||||||
|
This is useful when testing CAS directly.
|
||||||
|
It is only functional when debug is enabled. -->
|
||||||
|
<NoAuth>false</NoAuth>
|
||||||
</Config>
|
</Config>
|
||||||
|
|||||||
4
main.go
4
main.go
@ -37,6 +37,7 @@ var baseUrl string
|
|||||||
var pool *pgxpool.Pool
|
var pool *pgxpool.Pool
|
||||||
var ctx = context.Background()
|
var ctx = context.Background()
|
||||||
var isDebug = false
|
var isDebug = false
|
||||||
|
var ignoreAuth = false
|
||||||
|
|
||||||
// checkError makes error handling not as ugly and inefficient.
|
// checkError makes error handling not as ugly and inefficient.
|
||||||
func checkError(err error) {
|
func checkError(err error) {
|
||||||
@ -58,6 +59,9 @@ func main() {
|
|||||||
|
|
||||||
fmt.Println("[i] Initializing core...")
|
fmt.Println("[i] Initializing core...")
|
||||||
isDebug = readConfig.Debug
|
isDebug = readConfig.Debug
|
||||||
|
if isDebug {
|
||||||
|
ignoreAuth = readConfig.NoAuth
|
||||||
|
}
|
||||||
|
|
||||||
// Start SQL.
|
// Start SQL.
|
||||||
dbString := fmt.Sprintf("postgres://%s:%s@%s/%s", readConfig.SQLUser, readConfig.SQLPass, readConfig.SQLAddress, readConfig.SQLDB)
|
dbString := fmt.Sprintf("postgres://%s:%s@%s/%s", readConfig.SQLUser, readConfig.SQLPass, readConfig.SQLAddress, readConfig.SQLDB)
|
||||||
|
|||||||
4
route.go
4
route.go
@ -150,6 +150,10 @@ const (
|
|||||||
|
|
||||||
// checkAuthentication validates various factors from a given request requiring authentication.
|
// checkAuthentication validates various factors from a given request requiring authentication.
|
||||||
func checkAuthentication(e *Envelope) (bool, error) {
|
func checkAuthentication(e *Envelope) (bool, error) {
|
||||||
|
if ignoreAuth {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Get necessary authentication identifiers.
|
// Get necessary authentication identifiers.
|
||||||
deviceToken, err := getKey(e.doc, "DeviceToken")
|
deviceToken, err := getKey(e.doc, "DeviceToken")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -40,6 +40,7 @@ type Config struct {
|
|||||||
SQLDB string `xml:"SQLDB"`
|
SQLDB string `xml:"SQLDB"`
|
||||||
|
|
||||||
Debug bool `xml:"Debug"`
|
Debug bool `xml:"Debug"`
|
||||||
|
NoAuth bool `xml:"NoAuth"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Envelope represents the root element of any response, soapenv:Envelope.
|
// Envelope represents the root element of any response, soapenv:Envelope.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user