fbarthelery / geekttrss

Geekttrss is an Tiny Tiny Rss reader application with transparent offline mode for the Android platform
GNU General Public License v3.0
52 stars 4 forks source link

Feature request: Add HTTP Basic authentication #5

Closed moneytoo closed 5 years ago

moneytoo commented 5 years ago

Please consider adding support for HTTP Basic authentication. I think it's good practice to add additional level of security (basic auth or client certs) over php apps that don't really need to be public.

I tried harcoding credentials in NetworkModule and it worked just fine (geekttrss actually seems and works really nice ;)):

        OkHttpClient.Builder okHttpBuilder = new OkHttpClient.Builder();

        okHttpBuilder.authenticator(new Authenticator() {
            @Override
            public Request authenticate(Route route, Response response) throws IOException {

                if (response.request().header("Authorization") != null)
                    return null;

                String credential = Credentials.basic("user", "123456");
                return response.request().newBuilder()
                        .header("Authorization", credential)
                        .build();
            }
        });
fbarthelery commented 5 years ago

I added support for Basic Http authentication. However my server is not protected by it so I didn't properly tested it.

It's released on the beta track for now, or you can compile the code. Let me know if it works properly for you. You can join the beta here

moneytoo commented 5 years ago

It works. Thank you!