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

feat(jwt): Implement JWT strategy for authentication #11

Merged
merged 1 commit into from
Sep 6, 2018

Conversation

collinewait
Copy link

@collinewait collinewait commented Sep 5, 2018

What does this PR do?

  • It implements a JWT strategy for authentication.

Description of Tasks to be completed?

  • Writing unit tests.
  • returning a token upon user registration.
  • implementing a custom backend JWT authentication.

How should this be manually tested?

  • After cloning the repo, cd into the directory.

  • Run pip install -r requirements.txt

  • Use Postman to try out the endpoints.
    /api/users/ endpoint for registration. Data format:

        {
    "user": {
       "username": "xxxxx",
       "email": "x@y.com",
       "password": "testing"
       }
       }  
    
    

/api/users/login/ endpoint for login. Data format:

 {
"user": {
	"email": "x@y.com",
	"password": "testing"
    }
   }

/api/user/ endpoint to for getting a current user. Authentication is required so
add the token in the header section after login.

What are the relevant pivotal tracker stories?

Screenshots

  • Mentainability on codeclimate:

screen shot 2018-09-06 at 09 56 32

@coveralls
Copy link

coveralls commented Sep 5, 2018

Pull Request Test Coverage Report for Build 175

  • 104 of 104 (100.0%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+2.6%) to 95.399%

Totals Coverage Status
Change from base Build 137: 2.6%
Covered Lines: 311
Relevant Lines: 326

💛 - Coveralls

@Estaer Estaer had a problem deploying to ah-backend-staging-pr-11 September 6, 2018 00:26 Failure

class Meta:
model = User
# List all of the fields that could possibly be included in a request
# or response, including fields specified explicitly above.
fields = ['email', 'username', 'password']
fields = ['email', 'username', 'password', 'token']
#extra_kwargs = {'token': {'read_only': True}}

Choose a reason for hiding this comment

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

Why do we have this line in our codebase yet it is commented out?

Copy link
Author

@collinewait collinewait Sep 6, 2018

Choose a reason for hiding this comment

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

I am to remove it.

  - write unit tests
  - return a token upon user registration
  - return a token upon user login
  - implement a custom backend
@inno-asiimwe inno-asiimwe merged commit 3f94207 into develop Sep 6, 2018
@inno-asiimwe inno-asiimwe deleted the ft-jwt-159952000 branch September 6, 2018 13:41
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.

None yet

4 participants