login seems to work

This commit is contained in:
oskar 2026-01-12 20:12:10 +01:00
parent d5b28ad972
commit 711201dd9c
5 changed files with 15 additions and 9 deletions

View file

@ -64,6 +64,8 @@ management:
logging: logging:
level: level:
root: INFO root: INFO
org.springframework.security: DEBUG
org.springframework.web: DEBUG
--- ---
spring: spring:

View file

@ -3,7 +3,7 @@ package com.mosenioring.common.security
import jakarta.servlet.FilterChain import jakarta.servlet.FilterChain
import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse import jakarta.servlet.http.HttpServletResponse
import org.springframework.context.annotation.Profile import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.beans.factory.annotation.Value import org.springframework.beans.factory.annotation.Value
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken import org.springframework.security.authentication.UsernamePasswordAuthenticationToken
import org.springframework.security.core.authority.SimpleGrantedAuthority import org.springframework.security.core.authority.SimpleGrantedAuthority
@ -12,7 +12,7 @@ import org.springframework.stereotype.Component
import org.springframework.web.filter.OncePerRequestFilter import org.springframework.web.filter.OncePerRequestFilter
@Component @Component
@Profile("local") @ConditionalOnProperty(name = ["ALLOW_LOCAL_AUTH"], havingValue = "true")
class LocalAuthFilter( class LocalAuthFilter(
@Value("\${ALLOW_LOCAL_AUTH:false}") private val allowLocalAuth: Boolean @Value("\${ALLOW_LOCAL_AUTH:false}") private val allowLocalAuth: Boolean
) : OncePerRequestFilter() { ) : OncePerRequestFilter() {

View file

@ -83,7 +83,7 @@ flutter run -d <device_id> \
``` ```
Redirect configuration: Redirect configuration:
- Android: `android/app/src/main/AndroidManifest.xml` includes an intent-filter for `com.mosenioring.app://oauth2redirect`. - Android: `android/app/build.gradle.kts` sets `appAuthRedirectScheme`/`appAuthRedirectHost` for AppAuth, and `android/app/src/main/AndroidManifest.xml` registers the `RedirectUriReceiverActivity`.
- iOS: `ios/Runner/Info.plist` registers `com.mosenioring.app` under `CFBundleURLTypes`. - iOS: `ios/Runner/Info.plist` registers `com.mosenioring.app` under `CFBundleURLTypes`.
Launcher icons: Launcher icons:

View file

@ -9,7 +9,6 @@
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true" android:exported="true"
android:launchMode="singleTop" android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme" android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
@ -26,13 +25,18 @@
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter> </intent-filter>
<intent-filter android:autoVerify="true"> </activity>
<activity
android:name="net.openid.appauth.RedirectUriReceiverActivity"
android:exported="true"
android:theme="@style/Theme.AppCompat.Translucent.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.BROWSABLE"/>
<data <data
android:scheme="com.mosenioring.app" android:scheme="${appAuthRedirectScheme}"
android:host="oauth2redirect"/> android:host="${appAuthRedirectHost}"/>
</intent-filter> </intent-filter>
</activity> </activity>
<!-- Don't delete the meta-data below. <!-- Don't delete the meta-data below.

View file

@ -27,7 +27,7 @@ class AuthRemoteDataSource {
allowInsecureConnections: _config.allowInsecureConnections, allowInsecureConnections: _config.allowInsecureConnections,
loginHint: email, loginHint: email,
promptValues: const ['login'], promptValues: const ['login'],
scopes: const ['openid', 'profile', 'offline_access'], scopes: const ['openid', 'profile'],
), ),
); );
@ -57,7 +57,7 @@ class AuthRemoteDataSource {
discoveryUrl: _config.keycloakDiscoveryUrl, discoveryUrl: _config.keycloakDiscoveryUrl,
allowInsecureConnections: _config.allowInsecureConnections, allowInsecureConnections: _config.allowInsecureConnections,
refreshToken: refreshToken, refreshToken: refreshToken,
scopes: const ['openid', 'profile', 'offline_access'], scopes: const ['openid', 'profile'],
), ),
); );