Skip to content

Commit 439f7d0

Browse files
committed
ALT-10993 all outdated oauth properties files removed
1 parent 80c18be commit 439f7d0

5 files changed

Lines changed: 5 additions & 74 deletions

File tree

.gitignore

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,7 @@ classes/
4343
dependencies/
4444
/helpers/venv/
4545

46-
47-
# oauth properties files
4846
secret.properties
49-
# old location of twitter properties
50-
intellij-plugin/hs-Kotlin/resources/twitter/kotlin_koans/oauth_twitter.properties
51-
intellij-plugin/hs-core/resources/twitter/oauth_twitter.properties
52-
intellij-plugin/hs-core/resources/stepik/stepik.properties
53-
intellij-plugin/hs-core/resources/hyperskill/hyperskill-oauth.properties
54-
intellij-plugin/hs-core/resources/linkedin/linkedin-oauth.properties
55-
intellij-plugin/hs-core/resources/marketplace/marketplace-oauth.properties
56-
intellij-plugin/hs-core/resources/lti/lti-auth.properties
57-
#AES key
58-
hs-edu-format/resources/aes/aes.properties
59-
intellij-plugin/hs-core/resources/aes/aes.properties
6047
# don't commit changes in hyperskill css
6148
intellij-plugin/hs-core/resources/style/hyperskill_task.css
6249

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hyperskillClientId=GKpYyTCgF2KRywYibxdPZ8wLSfVMAeJU38F1uG1Z

intellij-plugin/hs-core/src/org/hyperskill/academy/learning/stepik/hyperskill/HyperskillOAuthBundle.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import org.hyperskill.academy.learning.messages.EduPropertiesBundle
44
import org.jetbrains.annotations.NonNls
55
import org.jetbrains.annotations.PropertyKey
66

7-
@NonNls
8-
private const val BUNDLE_NAME = "hyperskill.hyperskill-oauth"
7+
private const val BUNDLE_NAME: @NonNls String = "hyperskill.oauth"
98

109
object HyperskillOAuthBundle : EduPropertiesBundle(BUNDLE_NAME) {
1110
fun value(@PropertyKey(resourceBundle = BUNDLE_NAME) key: String): String {

intellij-plugin/hs-core/src/org/hyperskill/academy/learning/stepik/hyperskill/api/HyperskillConnector.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ abstract class HyperskillConnector : EduOAuthCodeFlowConnector<HyperskillAccount
5656
get() {
5757
return URIBuilder(HYPERSKILL_URL)
5858
.setPath("/oauth2/authorize/")
59-
.addParameter("client_id", CLIENT_ID)
59+
.addParameter("client_id", clientId)
6060
.addParameter("grant_type", CODE_ARGUMENT)
6161
.addParameter("redirect_uri", getRedirectUri())
6262
.addParameter("response_type", CODE_ARGUMENT)
@@ -67,7 +67,8 @@ abstract class HyperskillConnector : EduOAuthCodeFlowConnector<HyperskillAccount
6767
.addParameter("utm_content", "login")
6868
}
6969

70-
override val clientId: String = CLIENT_ID
70+
override val clientId: String
71+
get() = HyperskillOAuthBundle.value("hyperskillClientId")
7172

7273
override val objectMapper: ObjectMapper by lazy {
7374
val module = SimpleModule()
@@ -479,8 +480,6 @@ abstract class HyperskillConnector : EduOAuthCodeFlowConnector<HyperskillAccount
479480
companion object {
480481
private val LOG: Logger = logger<HyperskillConnector>()
481482

482-
private val CLIENT_ID: String = HyperskillOAuthBundle.value("hyperskillClientId")
483-
484483
fun getInstance(): HyperskillConnector = service()
485484

486485
/**

settings.gradle.kts

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import java.util.Properties
2-
31
rootProject.name = "hyperskill-plugin"
42
include(
53
"hs-edu-format",
@@ -31,59 +29,6 @@ include(
3129
)
3230

3331
// Note: hs-remote-env is excluded - doesn't compile with 2025.2+
34-
35-
val secretPropertiesFilename: String = "secret.properties"
36-
37-
configureSecretProperties()
38-
39-
fun configureSecretProperties() {
40-
val secretProperties = file(secretPropertiesFilename)
41-
if (!secretProperties.exists()) {
42-
secretProperties.createNewFile()
43-
}
44-
45-
val properties = loadProperties(secretPropertiesFilename)
46-
47-
properties.extractAndStore(
48-
"intellij-plugin/hs-core/resources/stepik/stepik.properties",
49-
"stepikClientId",
50-
"cogniterraClientId",
51-
)
52-
properties.extractAndStore(
53-
"intellij-plugin/hs-core/resources/hyperskill/hyperskill-oauth.properties",
54-
"hyperskillClientId",
55-
)
56-
properties.extractAndStore(
57-
"intellij-plugin/hs-core/resources/twitter/oauth_twitter.properties",
58-
"xClientId"
59-
)
60-
properties.extractAndStore(
61-
"intellij-plugin/hs-core/resources/linkedin/linkedin-oauth.properties",
62-
"linkedInClientId",
63-
"linkedInClientSecret"
64-
)
65-
properties.extractAndStore(
66-
"hs-edu-format/resources/aes/aes.properties",
67-
"aesKey"
68-
)
69-
}
70-
71-
fun loadProperties(path: String): Properties {
72-
val properties = Properties()
73-
file(path).bufferedReader().use { properties.load(it) }
74-
return properties
75-
}
76-
77-
fun Properties.extractAndStore(path: String, vararg keys: String) {
78-
val properties = Properties()
79-
for (key in keys) {
80-
properties[key] = getProperty(key) ?: ""
81-
}
82-
val file = file(path)
83-
file.parentFile?.mkdirs()
84-
file.bufferedWriter().use { properties.store(it, "") }
85-
}
86-
8732
// Note: downloadHyperskillCss() was removed from settings.gradle.kts
8833
// CSS download is now done lazily in hs-core/build.gradle.kts processResources task
8934

0 commit comments

Comments
 (0)