Skip to content

Commit

Permalink
fix access modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbalakirev committed Aug 13, 2024
1 parent 2c578a4 commit d24b0b3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
27 changes: 11 additions & 16 deletions src/main/java/com/corbado/services/SessionService.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.corbado.services;

import java.security.interfaces.RSAPublicKey;
import java.util.concurrent.TimeUnit;

import org.apache.commons.lang3.StringUtils;

import com.auth0.jwk.Jwk;
import com.auth0.jwk.JwkException;
import com.auth0.jwk.JwkProvider;
Expand All @@ -12,9 +17,7 @@
import com.auth0.jwt.interfaces.DecodedJWT;
import com.corbado.entities.SessionValidationResult;
import com.corbado.utils.ValidationUtils;
import java.security.interfaces.RSAPublicKey;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.StringUtils;

import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
Expand All @@ -31,25 +34,19 @@ public class SessionService {
private static final int JWK_CACHE_SIZE = 100;

/** The short session cookie name. */
private final String shortSessionCookieName;
private String shortSessionCookieName;

/** The issuer. */
private final String issuer;
private String issuer;

/** The jwks uri. */
private final String jwksUri;
private String jwksUri;

/** The last short session validation result. */
private String lastShortSessionValidationResult;

/** The short session length. */
private int shortSessionLength = 300; // Default short session length in seconds

/** The cache keys. */
private boolean cacheKeys = false;

/** The jwk provider. */
private final JwkProvider jwkProvider;
private JwkProvider jwkProvider;

/**
* Instantiates a new session service.
Expand All @@ -72,8 +69,6 @@ public SessionService(
this.shortSessionCookieName = shortSessionCookieName;
this.issuer = issuer;
this.jwksUri = jwksUri;
this.shortSessionLength = shortSessionLength;
this.cacheKeys = cacheKeys;

final JwkProviderBuilder jwkProviderBuilder = new JwkProviderBuilder(this.jwksUri);
if (cacheKeys) {
Expand Down Expand Up @@ -107,7 +102,7 @@ private SessionValidationResult getAndValidateUserFromShortSessionValue(
try {
// Get the signing key
DecodedJWT decodedJwt = JWT.decode(shortSession);
final Jwk jwk = jwkProvider.get(decodedJwt.getKeyId());
final Jwk jwk = this.jwkProvider.get(decodedJwt.getKeyId());
if (jwk == null) {
throw new SigningKeyNotFoundException(shortSession, null);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/corbado/services/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public UserEntity createActiveByName(@NonNull final String fullName)
* @param userId the user id
* @throws CorbadoServerException exception thrown on error or if user is not found
*/
public void delete(final String userId) throws CorbadoServerException {
public void delete(@NonNull final String userId) throws CorbadoServerException {
try {
this.client.userDelete(userId);

Expand All @@ -111,7 +111,7 @@ public void delete(final String userId) throws CorbadoServerException {
* @return UserGetRsp Response
* @throws CorbadoServerException If any server-side error occurs.
*/
public UserEntity get(final String userId) throws CorbadoServerException {
public UserEntity get(@NonNull final String userId) throws CorbadoServerException {
try {
return new UserEntity(this.client.userGet(userId));
} catch (final ApiException e) {
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/com/corbado/integration/UserServiceIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ void test_UserDelete_ExpectSuccess() throws CorbadoServerException, StandardExce
CorbadoServerException.class,
() -> {
final UserEntity ret = this.fixture.get(user.getUserID());
System.out.println(ret.toString());
});
assertNotNull(e);
assertEquals(400, e.getHttpStatusCode());
Expand All @@ -93,7 +92,6 @@ void test_UserGet_ExpectNotFound() {
CorbadoServerException.class,
() -> {
final UserEntity ret = this.fixture.get("usr-1234567890");
System.out.println(ret.toString());
});
assertNotNull(e);
assertEquals(400, e.getHttpStatusCode());
Expand Down

0 comments on commit d24b0b3

Please sign in to comment.