Reader small image

You're reading from  Building Web Applications with Flask

Product typeBook
Published inJun 2015
Reading LevelBeginner
Publisher
ISBN-139781784396152
Edition1st Edition
Languages
Tools
Right arrow
Authors (4):
Italo M Campelo Maia
Italo M Campelo Maia
author image
Italo M Campelo Maia

Italo Maia is a full-stack developer with 10 years of experience in creating software for the mobile, Web, and desktop environments, having dedicated most of the last few years to development with Python and web technologies. Author of Flask-Empty, a popular skeleton for Flask projects that aggregates good practices and recipes for quick prototyping, he is active in the Brazilian Python communities, having open source tools and libraries available in GitHub and Bitbucket.
Read more about Italo M Campelo Maia

Jack Stouffer
Jack Stouffer
author image
Jack Stouffer

Jack Stouffer is a programmer who has several years of experience in designing web applications. He switched to Flask three years ago for all his projects. He currently works for Apollo America in Auburn Hills, Michigan, and writes internal business tools and software using Python, Flask, and JavaScript. Jack is a believer and supporter of open source technology. When he released his Flask examples with the recommended best practices on GitHub (https://github.com/JackStouffer), it became one of the most popular Flask repositories on the site. Jack has also worked as a reviewer for Flask Framework Cookbook, Packt Publishing.
Read more about Jack Stouffer

Gareth Dwyer
Gareth Dwyer
author image
Gareth Dwyer

Gareth Dwyer hails from South Africa but now lives in Europe. He is a software engineer and author and is currently serving as the CTO at the largest coding education provider in Africa. Gareth is passionate about technology, education, and sharing knowledge through mentorship. He holds four university degrees in computer science and machine learning, with a specialization in natural language processing. He has worked with companies such as Amazon Web Services and has published many online tutorials as well as the book Flask by Example.
Read more about Gareth Dwyer

Italo Maia
Italo Maia
author image
Italo Maia

Italo Maia is a full-stack developer with 10 years of experience in creating software for the mobile, Web, and desktop environments, having dedicated most of the last few years to development with Python and web technologies. Author of Flask-Empty, a popular skeleton for Flask projects that aggregates good practices and recipes for quick prototyping, he is active in the Brazilian Python communities, having open source tools and libraries available in GitHub and Bitbucket.
Read more about Italo Maia

View More author details
Right arrow

Flask-Principal and Flask-Login (aka Batman and Robin)


As described in the project page (https://pythonhosted.org/Flask-Principal/), Flask-Principal is a permission extension. It manages who can access what and to what extent. You usually should use it with an authentication and session manager, as is the case of Flask-Login, another extension we'll learn in this section.

Flask-Principal handles permissions through four simple entities: Identity, IdentityContext, Need, and Permission.

  • Identity: This implies the way Flask-Principal identifies a user.

  • IdentityContext: This implies the context of a user tested against Permission. It is used to verify whether the user has the right to do something. It can be used as a decorator (block unauthorized access) or as a context manager (only execute).

    A Need is a criterion you need (aha moment!) to satisfy in order to do something, such as having a role or a permission. There are a few preset needs available with Principal, but you may create your own...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Building Web Applications with Flask
Published in: Jun 2015Publisher: ISBN-13: 9781784396152

Authors (4)

author image
Italo M Campelo Maia

Italo Maia is a full-stack developer with 10 years of experience in creating software for the mobile, Web, and desktop environments, having dedicated most of the last few years to development with Python and web technologies. Author of Flask-Empty, a popular skeleton for Flask projects that aggregates good practices and recipes for quick prototyping, he is active in the Brazilian Python communities, having open source tools and libraries available in GitHub and Bitbucket.
Read more about Italo M Campelo Maia

author image
Jack Stouffer

Jack Stouffer is a programmer who has several years of experience in designing web applications. He switched to Flask three years ago for all his projects. He currently works for Apollo America in Auburn Hills, Michigan, and writes internal business tools and software using Python, Flask, and JavaScript. Jack is a believer and supporter of open source technology. When he released his Flask examples with the recommended best practices on GitHub (https://github.com/JackStouffer), it became one of the most popular Flask repositories on the site. Jack has also worked as a reviewer for Flask Framework Cookbook, Packt Publishing.
Read more about Jack Stouffer

author image
Gareth Dwyer

Gareth Dwyer hails from South Africa but now lives in Europe. He is a software engineer and author and is currently serving as the CTO at the largest coding education provider in Africa. Gareth is passionate about technology, education, and sharing knowledge through mentorship. He holds four university degrees in computer science and machine learning, with a specialization in natural language processing. He has worked with companies such as Amazon Web Services and has published many online tutorials as well as the book Flask by Example.
Read more about Gareth Dwyer

author image
Italo Maia

Italo Maia is a full-stack developer with 10 years of experience in creating software for the mobile, Web, and desktop environments, having dedicated most of the last few years to development with Python and web technologies. Author of Flask-Empty, a popular skeleton for Flask projects that aggregates good practices and recipes for quick prototyping, he is active in the Brazilian Python communities, having open source tools and libraries available in GitHub and Bitbucket.
Read more about Italo Maia