-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from DreamExposure/develop
RC 4.2.3
- Loading branch information
Showing
176 changed files
with
2,594 additions
and
3,019 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
cam/src/main/kotlin/org/dreamexposure/discal/cam/business/OauthStateService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.dreamexposure.discal.cam.business | ||
|
||
import org.dreamexposure.discal.OauthStateCache | ||
import org.dreamexposure.discal.core.crypto.KeyGenerator | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class OauthStateService( | ||
private val stateCache: OauthStateCache, | ||
) { | ||
suspend fun generateState(): String { | ||
val state = KeyGenerator.csRandomAlphaNumericString(64) | ||
stateCache.put(state, state) | ||
|
||
return state | ||
} | ||
|
||
suspend fun validateState(state: String) = stateCache.getAndRemove(state) != null | ||
} |
Oops, something went wrong.