Skip to content

Commit

Permalink
Implemented the basic authentication flow, greatly simplifying login
Browse files Browse the repository at this point in the history
  • Loading branch information
Mindavi committed Jul 23, 2018
1 parent 2bebdc7 commit da81f9c
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 299 deletions.
6 changes: 2 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "eu.rickvanschijndel.solargraph"
minSdkVersion 16
targetSdkVersion 27
versionCode 7
versionName "1.6"
versionCode 8
versionName "1.7"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -31,8 +31,6 @@ dependencies {
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
implementation 'com.github.franmontiel:PersistentCookieJar:v1.0.1'
implementation 'org.jsoup:jsoup:1.11.3'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.15'

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package eu.rickvanschijndel.solargraph

/**
* taken from: Alphaaa, https://stackoverflow.com/a/36056355
*/

import okhttp3.Credentials
import okhttp3.Interceptor
import okhttp3.Response

class BasicAuthInterceptor(user: String, password: String): Interceptor {
private val credentials = Credentials.basic(user, password)

override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()
val authenticatedRequest = request.newBuilder()
.header("Authorization", credentials).build()
return chain.proceed(authenticatedRequest)
}
}
154 changes: 0 additions & 154 deletions app/src/main/java/eu/rickvanschijndel/solargraph/Login.kt

This file was deleted.

12 changes: 0 additions & 12 deletions app/src/main/java/eu/rickvanschijndel/solargraph/LoginCallback.kt

This file was deleted.

Loading

0 comments on commit da81f9c

Please sign in to comment.