-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(backend): Use github OAuth token
* Github oauth mitigates the github rate limit problem * Rewrote all tests to use only requests and cookies * Removed jwt and auth sessions in favor of using cookies * This breaks front dev flow, and needs to be fixed.
- Loading branch information
Showing
25 changed files
with
850 additions
and
844 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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,29 @@ | ||
package com.grohden.repotagger | ||
|
||
import io.ktor.application.ApplicationCall | ||
import io.ktor.sessions.get | ||
import io.ktor.sessions.sessions | ||
|
||
const val TAGGER_SESSION_COOKIE = "SESSION_ID" | ||
|
||
class NoSessionException : RuntimeException() | ||
|
||
|
||
/** | ||
* Base session data for the app | ||
*/ | ||
class TaggerSessionUser( | ||
val githubUserId: Int, | ||
val name: String, | ||
val token: String | ||
) | ||
|
||
/** | ||
* Requires a session, if no session is | ||
* present [NoSessionException] is thrown | ||
*/ | ||
fun ApplicationCall.requireSession(): TaggerSessionUser { | ||
val session = sessions.get<TaggerSessionUser>() | ||
|
||
return session ?: throw NoSessionException() | ||
} |
Oops, something went wrong.