mirror of
https://github.com/weloe/token-go.git
synced 2025-10-02 06:12:15 +08:00
fix: update Readme.md
This commit is contained in:
@@ -76,9 +76,9 @@ func Kickout(w http.ResponseWriter, req *http.Request) {
|
|||||||
|
|
||||||
The same user can only log in once: `IsConcurrent = false && IsShare = false`
|
The same user can only log in once: `IsConcurrent = false && IsShare = false`
|
||||||
|
|
||||||
The same user logs in multiple times and shares a token: `IsConcurrent = true && IsShare = false`
|
The same user logs in multiple times and shares a token: `IsConcurrent = true && IsShare = true`
|
||||||
|
|
||||||
Multiple logins of the same user to multiple tokens: `IsConcurrent = true && IsShare = true`
|
Multiple logins of the same user to multiple tokens: `IsConcurrent = true && IsShare = false`
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import (
|
import (
|
||||||
|
@@ -294,6 +294,7 @@ func TestEnforcer_Kickout(t *testing.T) {
|
|||||||
|
|
||||||
func TestEnforcerNotConcurrentNotShareLogin(t *testing.T) {
|
func TestEnforcerNotConcurrentNotShareLogin(t *testing.T) {
|
||||||
err, enforcer, ctx := NewTestNotConcurrentEnforcer(t)
|
err, enforcer, ctx := NewTestNotConcurrentEnforcer(t)
|
||||||
|
t.Logf("concurrent: %v, share: %v", enforcer.config.IsConcurrent, enforcer.config.IsShare)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("InitWithConfig() failed: %v", err)
|
t.Errorf("InitWithConfig() failed: %v", err)
|
||||||
}
|
}
|
||||||
@@ -315,6 +316,7 @@ func TestEnforcerNotConcurrentNotShareLogin(t *testing.T) {
|
|||||||
|
|
||||||
func TestEnforcer_ConcurrentShare(t *testing.T) {
|
func TestEnforcer_ConcurrentShare(t *testing.T) {
|
||||||
err, enforcer, ctx := NewTestEnforcer(t)
|
err, enforcer, ctx := NewTestEnforcer(t)
|
||||||
|
t.Logf("concurrent: %v, share: %v", enforcer.config.IsConcurrent, enforcer.config.IsShare)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("InitWithConfig() failed: %v", err)
|
t.Errorf("InitWithConfig() failed: %v", err)
|
||||||
}
|
}
|
||||||
@@ -336,6 +338,7 @@ func TestEnforcer_ConcurrentShare(t *testing.T) {
|
|||||||
}
|
}
|
||||||
func TestEnforcer_ConcurrentNotShareMultiLogin(t *testing.T) {
|
func TestEnforcer_ConcurrentNotShareMultiLogin(t *testing.T) {
|
||||||
err, enforcer, ctx := NewTestConcurrentEnforcer(t)
|
err, enforcer, ctx := NewTestConcurrentEnforcer(t)
|
||||||
|
t.Logf("concurrent: %v, share: %v", enforcer.config.IsConcurrent, enforcer.config.IsShare)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("InitWithConfig() failed: %v", err)
|
t.Errorf("InitWithConfig() failed: %v", err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user