Skip to content

Commit

Permalink
Renamed short-term session to session-token
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbalakirev committed Oct 27, 2024
1 parent 3348023 commit 01707b0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 26 deletions.
6 changes: 2 additions & 4 deletions src/main/java/com/corbado/sdk/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import java.net.MalformedURLException;
import java.net.URL;

import org.apache.commons.lang3.StringUtils;

import lombok.Builder;
import lombok.Getter;
import lombok.NonNull;
Expand Down Expand Up @@ -45,8 +43,8 @@ public class Config {
/** The backend api with custom setter. */
@Getter private String backendApi;

/** The short session cookie name. Default value: "cbo_short_session" */
@Getter @Setter @Builder.Default private String shortSessionCookieName = "cbo_short_session";
/** The short session cookie name. Default value: "cbo_session_token" */
@Getter @Setter @Builder.Default private String shortSessionCookieName = "cbo_session_token";

/** The issuer. Used for session verification. */
@Getter @Setter private String issuer;
Expand Down
41 changes: 19 additions & 22 deletions src/test/java/com/corbado/unit/SessionServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,23 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.anyString;

import com.auth0.jwk.Jwk;
import com.auth0.jwk.JwkException;
import com.auth0.jwk.JwkProvider;
import com.auth0.jwk.SigningKeyNotFoundException;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.exceptions.IncorrectClaimException;
import com.auth0.jwt.exceptions.JWTDecodeException;
import com.auth0.jwt.exceptions.JWTVerificationException;
import com.auth0.jwt.exceptions.TokenExpiredException;
import com.corbado.entities.SessionValidationResult;
import com.corbado.exceptions.StandardException;
import com.corbado.services.SessionService;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
Expand All @@ -24,7 +40,6 @@
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -36,24 +51,6 @@
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;

import com.auth0.jwk.Jwk;
import com.auth0.jwk.JwkException;
import com.auth0.jwk.JwkProvider;
import com.auth0.jwk.SigningKeyNotFoundException;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.exceptions.IncorrectClaimException;
import com.auth0.jwt.exceptions.JWTDecodeException;
import com.auth0.jwt.exceptions.JWTVerificationException;
import com.auth0.jwt.exceptions.TokenExpiredException;
import com.corbado.entities.SessionValidationResult;
import com.corbado.exceptions.StandardException;
import com.corbado.services.SessionService;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;

/** Unit Test for session service. */
@ExtendWith(MockitoExtension.class)
public class SessionServiceTest {
Expand Down Expand Up @@ -186,7 +183,7 @@ void testInitParametersValidation(
*/
@ParameterizedTest
@MethodSource("provideJwts")
void test_getCurrentUser(final String jwt, Class<Exception> e)
void test_getCurrentUser(final String jwt, final Class<Exception> e)
throws StandardException, IncorrectClaimException, JWTVerificationException, JwkException {

if (e != null) {
Expand Down Expand Up @@ -340,7 +337,7 @@ private static String generateJwt(final String iss, final long exp, final long n
*/
private static SessionService createSessionService() {
return new SessionService(
"cbo_short_session",
"cbo_session_token",
"https://auth.acme.com",
"https://example_uri.com",
10,
Expand Down

0 comments on commit 01707b0

Please sign in to comment.