Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added digest auth #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Added digest auth #56

wants to merge 2 commits into from

Conversation

amadeu01
Copy link
Contributor

I had a problem that the Camera URL use some digest authentication. So, I included a library for handle this kind of authentication, for more information about the dependency included here. It simply handles the digest authentication throughout HTTP when it is needed.

@niqdev
Copy link
Owner

niqdev commented Apr 13, 2018

@amadeu01 thanks for you PR, I need to fix #57 first and once done i'll ask you to resolve the conflicts if any, I'll ping you once is done, thanks

@niqdev
Copy link
Owner

niqdev commented Apr 13, 2018

I've created a branch but is still unstable, have a look if you want

@amadeu01
Copy link
Contributor Author

@niqdev I will have a look!

@amadeu01 amadeu01 closed this Apr 14, 2018
@amadeu01 amadeu01 reopened this Apr 14, 2018
@amadeu01
Copy link
Contributor Author

Sorry, I pressed the button accidentally

@niqdev
Copy link
Owner

niqdev commented Apr 18, 2018

@amadeu01 can you please resolve the conflicts?

@@ -13,7 +13,7 @@ buildscript {

allprojects {
group = 'com.github.niqdev'
version = '1.3.2'
version = '1.3.3'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert this, I will change it when release the lib

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay

Copy link
Contributor Author

@amadeu01 amadeu01 Apr 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, It could be done by gradle task.

def getVersionCode = { ->
  try {
    def code = new ByteArrayOutputStream()
    exec {
      commandLine 'git', 'rev-list', 'HEAD', '--count'
      standardOutput = code
    }
    return Integer.parseInt(code.toString().trim())
  } catch (exception) {
    return "1";
  }
}

// Version name is Last Tag Name + No. of commits form last Tag +  short git sha
def getVersionName = { ->
  try {
    def stdout = new ByteArrayOutputStream()
    exec {
      commandLine 'git', 'describe', '--tags', '--dirty'
      standardOutput = stdout
    }
    return stdout.toString().trim()
  } catch (exception) {
    return "0.0.0.1";
  }
}

// Use
android{
  defaultConfig {
    ...
    versionCode getVersionCode()
    versionName getVersionName()
    ...
  }
}

@niqdev

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, so to use it properly i need to tag it just before release the lib i.e. ./gradlew build bintrayUpload. correct? can you add it in a different PR unless you think is going to be different in #59?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @niqdev
I will do another PR, for that change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, this should be set automatically.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you go #115

if (sendConnectionCloseHeader) {
urlConnection.setRequestProperty("Connection", "close");
}

if (urlConnection.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED && !TextUtils.isEmpty(username) && !TextUtils.isEmpty(password)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if is worth it, maybe extract it in a method and add comment for why is needed, otherwise is fine.
The important thing is that it must be retrocompatible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I will do it later. Thanks for your feedback

@amadeu01
Copy link
Contributor Author

@niqdev sorry for my delay, I’ll update it as soon as I got some free time. Thanks !

@hannesa2
Copy link
Contributor

Please rebase it to recent master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants