-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix custom headers on DB functions * remove files * Update PostgrestRpc.kt * Update version * Ignore 5XX http status codes for session refreshes * Fix detekt * Refactor SessionStatus * Fix detekt * Revert a docs change * Revert another docs change * Fix some doc issues
- Loading branch information
1 parent
5e42c27
commit 5de19c4
Showing
20 changed files
with
110 additions
and
66 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
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
22 changes: 22 additions & 0 deletions
22
Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/status/RefreshFailureCause.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,22 @@ | ||
package io.github.jan.supabase.auth.status | ||
|
||
import io.github.jan.supabase.exceptions.RestException | ||
|
||
/** | ||
* Represents the cause of a refresh error | ||
*/ | ||
sealed interface RefreshFailureCause { | ||
|
||
/** | ||
* The refresh failed due to a network error | ||
* @param exception The exception that caused the error | ||
*/ | ||
data class NetworkError(val exception: Throwable) : RefreshFailureCause | ||
|
||
/** | ||
* The refresh failed due to an internal server error | ||
* @param exception The rest exception that caused the error | ||
*/ | ||
data class InternalServerError(val exception: RestException) : RefreshFailureCause | ||
|
||
} |
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
43 changes: 43 additions & 0 deletions
43
Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/status/SessionStatus.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,43 @@ | ||
package io.github.jan.supabase.auth.status | ||
|
||
import io.github.jan.supabase.auth.Auth | ||
import io.github.jan.supabase.auth.user.UserSession | ||
|
||
/** | ||
* Represents the status of the current session in [Auth] | ||
*/ | ||
sealed interface SessionStatus { | ||
|
||
/** | ||
* This status means that the user is not logged in | ||
* @param isSignOut Whether this status was caused by a sign-out | ||
*/ | ||
data class NotAuthenticated(val isSignOut: Boolean) : SessionStatus | ||
|
||
/** | ||
* This status means that [Auth] is currently initializing the session | ||
*/ | ||
data object Initializing : SessionStatus | ||
|
||
/** | ||
* This status means that [Auth] had an error while refreshing the session | ||
* @param cause The cause of the error | ||
*/ | ||
data class RefreshFailure(val cause: RefreshFailureCause) : SessionStatus | ||
|
||
/** | ||
* This status means that [Auth] holds a valid session | ||
* @param session The session | ||
* @param source The source of the session | ||
*/ | ||
data class Authenticated(val session: UserSession, val source: SessionSource = SessionSource.Unknown) : SessionStatus { | ||
|
||
/** | ||
* Whether the session is new, i.e. [source] is [SessionSource.SignIn], [SessionSource.SignUp] or [SessionSource.External]. | ||
* Use this to determine whether this status is the result of a new sign in or sign up or just a session refresh. | ||
*/ | ||
val isNew: Boolean = source is SessionSource.SignIn || source is SessionSource.SignUp || source is SessionSource.External | ||
|
||
} | ||
|
||
} |
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
1 change: 1 addition & 0 deletions
1
Auth/src/jsMain/kotlin/io/github/jan/supabase/auth/setupPlatform.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
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
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