Skip to content

Commit 519ae58

Browse files
committed
Logfix: Remove emojis
1 parent 3bbdd1b commit 519ae58

13 files changed

Lines changed: 506 additions & 383 deletions

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ OBP_API_URL=http://localhost:8080
7171
#
7272
# When true, you must also provide:
7373
# - OBP_API_URL (above)
74-
# - OBP_API_USERNAME (a user with CanVerifyUserCredentials and CanGetOidcClient roles)
74+
# - OBP_API_USERNAME (a user with CanVerifyUserCredentials, CanGetOidcClient and CanGetConsumers roles)
7575
# - OBP_API_PASSWORD (password for the above user)
7676
# - OBP_API_CONSUMER_KEY (consumer key for DirectLogin authentication)
7777
#

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ OBP-OIDC supports two modes for verifying users, clients, and listing providers,
224224
- Verifies clients via `GET /obp/v6.0.0/oidc/clients/CLIENT_ID`
225225
- Lists providers via `GET /obp/v6.0.0/providers`
226226
- Useful when you don't want to grant direct database access to OBP-OIDC
227-
- Requires `OBP_API_USERNAME` to have `CanVerifyUserCredentials` and `CanVerifyOidcClient` roles
227+
- Requires `OBP_API_USERNAME` to have `CanVerifyUserCredentials`, `CanGetOidcClient` and `CanGetConsumers` roles
228228
- When combined with `OIDC_SKIP_CLIENT_BOOTSTRAP=true`, no database connection is needed at all
229229

230230
**Configuration:**
@@ -236,7 +236,7 @@ USE_VERIFY_ENDPOINTS=false
236236
# Alternative: Use OBP API endpoints
237237
USE_VERIFY_ENDPOINTS=true
238238
OBP_API_URL=http://localhost:8080
239-
OBP_API_USERNAME=admin_user # Needs CanVerifyUserCredentials + CanVerifyOidcClient roles
239+
OBP_API_USERNAME=admin_user # Needs CanVerifyUserCredentials + CanGetOidcClient + CanGetConsumers roles
240240
OBP_API_PASSWORD=admin_password
241241
OBP_API_CONSUMER_KEY=your_consumer_key
242242
```

src/main/scala/com/tesobe/oidc/auth/CodeService.scala

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ class InMemoryCodeService(
8080

8181
_ <- codesRef.update(_ + (code -> authCode))
8282
_ = logger.info(
83-
s"Generated authorization code: ${code.take(8)}... for clientId: $clientId, redirectUri: $redirectUri, sub: $sub, expires in ${config.codeExpirationSeconds}s"
83+
s"Generated authorization code: ${code.take(8)}... for clientId: $clientId, redirectUri: $redirectUri, sub: $sub, expires in ${config.codeExpirationSeconds}s"
8484
)
8585
totalCodes <- codesRef.get.map(_.size)
86-
_ = logger.info(s"🔍 Total codes in memory: $totalCodes")
86+
_ = logger.info(s"Total codes in memory: $totalCodes")
8787
} yield code
8888
}
8989

@@ -96,32 +96,32 @@ class InMemoryCodeService(
9696
s"validateAndConsumeCode ENTRY - code: ${code.take(8)}..., clientId: $clientId"
9797
)
9898
logger.info(
99-
s"🔍 DEBUG: validateAndConsumeCode called with code: ${code.take(8)}..., clientId: $clientId"
99+
s"DEBUG: validateAndConsumeCode called with code: ${code.take(8)}..., clientId: $clientId"
100100
)
101101
for {
102102
codes <- codesRef.get
103103
_ = logger.trace(
104104
s"Found ${codes.size} stored codes in memory"
105105
)
106-
_ = logger.info(s"🔍 DEBUG: Found ${codes.size} stored codes")
106+
_ = logger.info(s"DEBUG: Found ${codes.size} stored codes")
107107
result <- codes.get(code) match {
108108
case Some(authCode) =>
109109
logger.trace(
110110
s"FOUND authorization code for client: ${authCode.client_id}, sub: ${authCode.sub}"
111111
)
112112
logger.info(
113-
s"🔍 DEBUG: Found authorization code for client: ${authCode.client_id}, sub: ${authCode.sub}"
113+
s"DEBUG: Found authorization code for client: ${authCode.client_id}, sub: ${authCode.sub}"
114114
)
115115
logger.info(
116-
s"🔍 DEBUG: Code expires at: ${authCode.exp}, current time: ${Instant.now().getEpochSecond}"
116+
s"DEBUG: Code expires at: ${authCode.exp}, current time: ${Instant.now().getEpochSecond}"
117117
)
118118
validateCode(authCode, clientId, redirectUri).flatMap {
119119
case Right(validCode) =>
120120
logger.trace(
121121
s"Authorization code validation SUCCESS for sub: ${validCode.sub}"
122122
)
123123
logger.info(
124-
s"DEBUG: Authorization code validated successfully for sub: ${validCode.sub}"
124+
s"DEBUG: Authorization code validated successfully for sub: ${validCode.sub}"
125125
)
126126
// Consume the code (remove it after use)
127127
codesRef.update(_ - code).as(validCode.asRight[OidcError])
@@ -131,7 +131,7 @@ class InMemoryCodeService(
131131
.getOrElse("No description")}"
132132
)
133133
logger.warn(
134-
s"DEBUG: Authorization code validation failed: ${error.error} - ${error.error_description
134+
s"DEBUG: Authorization code validation failed: ${error.error} - ${error.error_description
135135
.getOrElse("No description")}"
136136
)
137137
// Remove invalid code
@@ -142,13 +142,13 @@ class InMemoryCodeService(
142142
s"Authorization code NOT FOUND: ${code.take(8)}..."
143143
)
144144
logger.warn(
145-
s"DEBUG: Authorization code not found: ${code.take(8)}..."
145+
s"DEBUG: Authorization code not found: ${code.take(8)}..."
146146
)
147147
logger.warn(
148-
s"DEBUG: Available codes in memory: ${codes.keys.map(_.take(8)).mkString(", ")}"
148+
s"DEBUG: Available codes in memory: ${codes.keys.map(_.take(8)).mkString(", ")}"
149149
)
150150
logger.warn(
151-
s"DEBUG: Looking for exact code match for clientId: $clientId, redirectUri: $redirectUri"
151+
s"DEBUG: Looking for exact code match for clientId: $clientId, redirectUri: $redirectUri"
152152
)
153153
IO.pure(
154154
OidcError("invalid_grant", Some("Authorization code not found"))
@@ -167,32 +167,32 @@ class InMemoryCodeService(
167167
val now = Instant.now().getEpochSecond
168168

169169
logger.info(
170-
s"🔍 DEBUG: Validating code - Expected clientId: ${authCode.client_id}, Provided: $clientId"
170+
s"DEBUG: Validating code - Expected clientId: ${authCode.client_id}, Provided: $clientId"
171171
)
172172
logger.info(
173-
s"🔍 DEBUG: Validating code - Expected redirectUri: ${authCode.redirect_uri}, Provided: $redirectUri"
173+
s"DEBUG: Validating code - Expected redirectUri: ${authCode.redirect_uri}, Provided: $redirectUri"
174174
)
175175

176176
if (authCode.exp < now) {
177177
logger.warn(
178-
s"DEBUG: Authorization code expired (exp: ${authCode.exp}, now: $now)"
178+
s"DEBUG: Authorization code expired (exp: ${authCode.exp}, now: $now)"
179179
)
180180
OidcError("invalid_grant", Some("Authorization code expired"))
181181
.asLeft[AuthorizationCode]
182182
} else if (authCode.client_id != clientId) {
183183
logger.warn(
184-
s"DEBUG: Client ID mismatch (expected: ${authCode.client_id}, got: $clientId)"
184+
s"DEBUG: Client ID mismatch (expected: ${authCode.client_id}, got: $clientId)"
185185
)
186186
OidcError("invalid_grant", Some("Client ID mismatch"))
187187
.asLeft[AuthorizationCode]
188188
} else if (authCode.redirect_uri != redirectUri) {
189189
logger.warn(
190-
s"DEBUG: Redirect URI mismatch (expected: ${authCode.redirect_uri}, got: $redirectUri)"
190+
s"DEBUG: Redirect URI mismatch (expected: ${authCode.redirect_uri}, got: $redirectUri)"
191191
)
192192
OidcError("invalid_grant", Some("Redirect URI mismatch"))
193193
.asLeft[AuthorizationCode]
194194
} else {
195-
logger.info(s"DEBUG: All validations passed for code")
195+
logger.info(s"DEBUG: All validations passed for code")
196196
authCode.asRight[OidcError]
197197
}
198198
}

0 commit comments

Comments
 (0)