Skip to content

Commit 2eff456

Browse files
authored
Merge pull request #232 from LossyDragon/rev
Login Flow revisions
2 parents 667d746 + e3f8474 commit 2eff456

23 files changed

Lines changed: 941 additions & 58 deletions

File tree

build.gradle

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
// https://mvnrepository.com/artifact/com.google.protobuf/protobuf-gradle-plugin
55
plugins {
66
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
7-
id 'com.google.protobuf' version "0.9.2"
7+
id 'com.google.protobuf' version "0.9.4"
88
id 'jacoco'
99
id 'maven-publish'
10-
id 'org.jetbrains.kotlin.jvm' version '1.8.10'
10+
id 'org.jetbrains.kotlin.jvm' version '1.9.0'
1111
id 'projectversiongen'
1212
id 'signing'
1313
id 'steamlanguagegen'
1414
}
1515

1616
allprojects {
1717
group 'in.dragonbra'
18-
version '1.3.0-beta01'
18+
version '1.3.0'
1919
}
2020

2121
sourceCompatibility = 1.8
@@ -26,11 +26,11 @@ repositories {
2626

2727
// https://mvnrepository.com/artifact/com.google.protobuf/protoc
2828
protobuf.protoc {
29-
artifact = 'com.google.protobuf:protoc:3.22.2'
29+
artifact = 'com.google.protobuf:protoc:3.22.4'
3030
}
3131

3232
// https://www.eclemma.org/jacoco
33-
jacoco.toolVersion = "0.8.8"
33+
jacoco.toolVersion = "0.8.10"
3434

3535
jacocoTestReport.reports {
3636
xml.required = true
@@ -66,56 +66,47 @@ sourceSets.main {
6666
)
6767
}
6868

69-
compileKotlin {
70-
kotlinOptions {
71-
jvmTarget = "1.8"
72-
}
73-
}
74-
compileTestKotlin {
75-
kotlinOptions {
76-
jvmTarget = "1.8"
77-
}
78-
}
79-
8069
check.dependsOn jacocoTestReport
8170
compileJava.dependsOn(generateSteamLanguage)
8271
compileJava.dependsOn(generateProjectVersion)
8372

8473
dependencies {
8574
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
86-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-Beta")
75+
76+
// https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core
77+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
8778

8879
// https://mvnrepository.com/artifact/com.google.code.gson/gson
8980
implementation 'com.google.code.gson:gson:2.10.1'
9081
// https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java
91-
implementation 'com.google.protobuf:protobuf-java:3.22.2'
82+
implementation 'com.google.protobuf:protobuf-java:3.22.4'
9283
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
9384
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
9485
// https://mvnrepository.com/artifact/commons-validator/commons-validator
9586
implementation 'commons-validator:commons-validator:1.7'
9687
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
9788
implementation 'org.apache.commons:commons-lang3:3.12.0'
9889
// https://mvnrepository.com/artifact/org.java-websocket/Java-WebSocket
99-
implementation 'org.java-websocket:Java-WebSocket:1.5.3'
90+
implementation 'org.java-websocket:Java-WebSocket:1.5.4'
10091
// https://mvnrepository.com/artifact/commons-io/commons-io
101-
implementation 'commons-io:commons-io:2.11.0'
92+
implementation 'commons-io:commons-io:2.13.0'
10293

10394
/* Unit Testing */
10495

10596
// https://mvnrepository.com/artifact/com.squareup.okhttp3/mockwebserver3-junit5
10697
testImplementation 'com.squareup.okhttp3:mockwebserver3-junit5:5.0.0-alpha.11'
10798
// https://mvnrepository.com/artifact/commons-codec/commons-codec
108-
testImplementation 'commons-codec:commons-codec:1.15'
99+
testImplementation 'commons-codec:commons-codec:1.16.0'
109100
// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
110-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
101+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0'
111102
// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine
112-
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.2'
103+
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.0'
113104
// https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on
114105
testImplementation 'org.bouncycastle:bcprov-jdk15on:1.70'
115106
// https://mvnrepository.com/artifact/org.mockito/mockito-core
116107
testImplementation 'org.mockito:mockito-core:4.11.0'
117108
// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-params
118-
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.9.2'
109+
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.0'
119110
// https://mvnrepository.com/artifact/org.mockito/mockito-junit-jupiter
120111
testImplementation 'org.mockito:mockito-junit-jupiter:4.11.0'
121112
}

buildSrc/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies {
1414
implementation localGroovy()
1515

1616
// https://mvnrepository.com/artifact/commons-io/commons-io
17-
implementation 'commons-io:commons-io:2.11.0'
17+
implementation 'commons-io:commons-io:2.13.0'
1818
}
1919

2020
gradlePlugin {

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ signing.password=
33
signing.secretKeyRingFile=~/.gnupg/secring.gpg
44

55
ossrhUsername=
6-
ossrhPassword=
6+
ossrhPassword=
7+
8+
org.gradle.jvmargs=-Xmx1024m

gradle/wrapper/gradle-wrapper.jar

1.73 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

gradlew

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

javasteam-samples/build.gradle

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'java'
2+
id 'org.jetbrains.kotlin.jvm' version '1.9.0'
33
}
44

55
sourceCompatibility = 1.8
@@ -11,6 +11,9 @@ repositories {
1111
dependencies {
1212
implementation rootProject
1313

14+
// https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core
15+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
16+
1417
// https://mvnrepository.com/artifact/pro.leaco.qrcode/console-qrcode
1518
implementation 'pro.leaco.qrcode:console-qrcode:1.0.1'
1619

@@ -22,8 +25,8 @@ dependencies {
2225

2326
// To access protobufs directly as shown in Sample #2
2427
// https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java
25-
implementation 'com.google.protobuf:protobuf-java:3.22.2'
28+
implementation 'com.google.protobuf:protobuf-java:3.22.4'
2629

2730
// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
28-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
31+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0'
2932
}

javasteam-samples/src/main/java/in/dragonbra/javasteamsamples/_1logon/SampleLogonAuthentication.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
import com.google.gson.JsonElement;
66
import com.google.gson.JsonParser;
77
import in.dragonbra.javasteam.enums.EResult;
8-
import in.dragonbra.javasteam.steam.authentication.AuthPollResult;
9-
import in.dragonbra.javasteam.steam.authentication.AuthSessionDetails;
10-
import in.dragonbra.javasteam.steam.authentication.CredentialsAuthSession;
11-
import in.dragonbra.javasteam.steam.authentication.SteamAuthentication;
12-
import in.dragonbra.javasteam.steam.authentication.UserConsoleAuthenticator;
8+
import in.dragonbra.javasteam.steam.authentication.*;
139
import in.dragonbra.javasteam.steam.handlers.steamunifiedmessages.SteamUnifiedMessages;
1410
import in.dragonbra.javasteam.steam.handlers.steamuser.LogOnDetails;
1511
import in.dragonbra.javasteam.steam.handlers.steamuser.SteamUser;
@@ -23,6 +19,7 @@
2319
import in.dragonbra.javasteam.util.log.LogManager;
2420

2521
import java.util.Base64;
22+
import java.util.concurrent.CancellationException;
2623

2724
/**
2825
* @author lossy
@@ -114,7 +111,8 @@ private void onConnected(ConnectedCallback callback) {
114111

115112
CredentialsAuthSession authSession = auth.beginAuthSessionViaCredentials(authDetails);
116113

117-
AuthPollResult pollResponse = authSession.pollingWaitForResult();
114+
// AuthPollResult pollResponse = authSession.pollingWaitForResult(); // This method is for Kotlin (coroutines)
115+
AuthPollResult pollResponse = authSession.pollingWaitForResultCompat();
118116

119117
LogOnDetails details = new LogOnDetails();
120118
details.setUsername(pollResponse.getAccountName());
@@ -131,7 +129,15 @@ private void onConnected(ConnectedCallback callback) {
131129
// parseJsonWebToken(pollResponse.refreshToken, "RefreshToken");
132130
} catch (Exception e) {
133131
e.printStackTrace();
134-
throw new RuntimeException(e);
132+
133+
// List a couple of exceptions that could be important to handle.
134+
if (e instanceof AuthenticationException) {
135+
System.out.println("An Authentication error has occurred.");
136+
}
137+
138+
if (e instanceof CancellationException) {
139+
System.out.println("An Cancellation exception was raised. Usually means a timeout occurred");
140+
}
135141
}
136142
}
137143

0 commit comments

Comments
 (0)