LoginRadius / go-saml

High Level API Implementation of SAML 2.0 (Currently Supported Identity Provider Implementation) Single Sign On
MIT License
11 stars 13 forks source link

Improve error handling with custom human readable error message #5

Closed mayankagwl closed 4 years ago

mayankagwl commented 4 years ago

Is your feature request related to a problem? Please describe. Yes, Improve error handling

Describe the solution you'd like Improve error handling by using the Reject Struct that includes an error (actual error) and reason(Customized human error) So By looking at the Error, can know what exactly going wrong. Ex. Reject{err, "SAML_REQUEST_NOT_VALID"} Maintain the Reason Format (all caps with an underscore as separator)

Describe alternatives you've considered we are welcoming other better error handling as well to make error self-explanatory.

Additional context Some of the places implemented, take reference from https://github.com/LoginRadius/go-saml/blob/fa9f285de74b0771b4253e81e5a233641655e945/idp.go#L120

flitzmare commented 4 years ago

which classes do you need to implement Reject Struct as return ? only idp.go ?

mayankagwl commented 4 years ago

@flitzmare Yes, in the idp.go we need to implement the Reject Struct for error We can implement error interface for the Reject struct, and instead of returning the *Reject we can simply return the error containing the Reject instance, so it will return error with some extra information

mayankagwl commented 4 years ago

@flitzmare And LoginRadius is also giving swags to people who will be contributing, so please make sure to read our blog and submit your info to get free goodies.

https://www.loginradius.com/engineering/page/hacktoberfest2020