travelgateX / go-jwt-tools

Golang authorization middleware for JWT tokens. JWT tools
http://www.travelgatex.com
GNU General Public License v3.0
9 stars 9 forks source link

rm config package and package variables #2

Closed pperaltaisern closed 6 years ago

pperaltaisern commented 6 years ago

config/config.go config package removed, it belongs to the authorization package and it doesn't provides functionality on his own. Moved to authorization.go

Removed these package variables:

var (
    PublicKeyStr string 
    AdminGroup string
    IgnoreExpiration bool
 )

I see 2 bugs:

  1. An authorization handler is initialized from a config and these values should be specific for the own handler, and not shared between multiple handler instances
  2. AdminGroup is used in the getObject func (aux function for the permission table) and its only initialized by calling to Authorization, this doesn't permit to use the PermissionTable without a handler and its confusing.

Those var shouldn't be unexported for the package (solved since they are removed)

permissions.go NewPermissionTable can do a build, Build func removed and done in the constructor. permission as a type to clarification

Unused struct CheckPermission removed

constants.go moved the constant to the preparePermissions func (where it is used) and changed it to unexported, file deleted

also, I have some suggestions to do that we can talk in person :)

arquio commented 6 years ago

Great.

We can report this suggestions in the Issues tab..

Thanks @pperaltaisern