Skip to content

Commit

Permalink
Improve casdoor config
Browse files Browse the repository at this point in the history
  • Loading branch information
hsluoyz committed Dec 22, 2023
1 parent 9bbbcd0 commit 0cb4ea2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 22 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ dependencies {
Initialization requires 5 parameters, which are all str type:
| Name (in order) | Must | Description |
| ---------------- | ---- | --------------------------------------------------- |
| endpoint | Yes | Casdoor Server Url, such as `http://localhost:8000` |
| endpoint | Yes | Casdoor Server Url, such as `https://door.casdoor.com` |
| clientID | Yes | Application.clientID |
| appName | Yes | Application.name |
| organizationName | Yes |Organization name
| appName | Yes | Application name |
| organizationName | Yes |Organization name |

```kotlin
val casdoorConfig = CasdoorConfig(
endpoint = "http://localhost:8000",
clientID = "ced4d6db2f4644b85a75",
organizationName = "organization_6qvtvh",
endpoint = "https://door.casdoor.com",
clientID = "294b09fbc17f95daf2fe",
redirectUri = "casdoor://callback",
appName = "application_y38644"
organizationName = "casbin",
appName = "app-vue-python-example"
)
```

Expand Down
9 changes: 1 addition & 8 deletions library/src/main/java/org/casdoor/Casdoor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ import okhttp3.internal.EMPTY_REQUEST
import okio.IOException
import java.lang.reflect.Type


class Casdoor(private val config: CasdoorConfig) {

private var codeVerifier: String? = null
private var nonce: String? = null

Expand Down Expand Up @@ -103,7 +101,6 @@ class Casdoor(private val config: CasdoorConfig) {
throw IOException("response error: $it")
}
}

}

/**
Expand Down Expand Up @@ -132,7 +129,6 @@ class Casdoor(private val config: CasdoorConfig) {
}

}

}

/**
Expand Down Expand Up @@ -163,7 +159,6 @@ class Casdoor(private val config: CasdoorConfig) {
}

}

}

/**
Expand All @@ -185,6 +180,4 @@ class Casdoor(private val config: CasdoorConfig) {
}
}
}


}
}
13 changes: 6 additions & 7 deletions library/src/test/java/org/casdoor/CasdoorConfigTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ import org.junit.Test
class CasdoorConfigTest {
@Test
fun testCasdoorConfig() {

val casdoorConfig1 = CasdoorConfig(
clientID = "",
organizationName = "",
redirectUri = "",
endpoint = "http://bar.com",
appName = ""
endpoint = "https://door.casdoor.com",
clientID = "294b09fbc17f95daf2fe",
redirectUri = "casdoor://callback",
organizationName = "casbin",
appName = "app-vue-python-example"
)

assertEquals("http://bar.com", casdoorConfig1.endpoint)
assertEquals("https://door.casdoor.com", casdoorConfig1.endpoint)
}
}

0 comments on commit 0cb4ea2

Please sign in to comment.