mirror of
https://wiilab.wiimart.org/wiimart/WiiSOAP
synced 2025-09-03 20:11:14 +02: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.
|
||||
Can be extremely verbose. -->
|
||||
<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>
|
||||
|
4
main.go
4
main.go
@ -37,6 +37,7 @@ var baseUrl string
|
||||
var pool *pgxpool.Pool
|
||||
var ctx = context.Background()
|
||||
var isDebug = false
|
||||
var ignoreAuth = false
|
||||
|
||||
// checkError makes error handling not as ugly and inefficient.
|
||||
func checkError(err error) {
|
||||
@ -58,6 +59,9 @@ func main() {
|
||||
|
||||
fmt.Println("[i] Initializing core...")
|
||||
isDebug = readConfig.Debug
|
||||
if isDebug {
|
||||
ignoreAuth = readConfig.NoAuth
|
||||
}
|
||||
|
||||
// Start SQL.
|
||||
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.
|
||||
func checkAuthentication(e *Envelope) (bool, error) {
|
||||
if ignoreAuth {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// Get necessary authentication identifiers.
|
||||
deviceToken, err := getKey(e.doc, "DeviceToken")
|
||||
if err != nil {
|
||||
|
@ -40,6 +40,7 @@ type Config struct {
|
||||
SQLDB string `xml:"SQLDB"`
|
||||
|
||||
Debug bool `xml:"Debug"`
|
||||
NoAuth bool `xml:"NoAuth"`
|
||||
}
|
||||
|
||||
// Envelope represents the root element of any response, soapenv:Envelope.
|
||||
|
Loading…
x
Reference in New Issue
Block a user