You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: standardize codebase to use any instead of interface{}
- Replace occurrences of interface{} with any throughout the codebase and documentation for type arguments and return values.
- Update example functions, middleware initializations, and store interfaces to use any instead of interface{} for improved Go type standardization.
- Revise test cases to use map[string]any in place of map[string]interface{}.
- Update documentation and comments to reflect the use of any as the preferred type for generic data.
- Remove several stray empty lines from main files for minor formatting cleanup.
Signed-off-by: appleboy <[email protected]>
if loginVals.Username == "admin" && loginVals.Password == "admin" {
492
-
returnmap[string]interface{}{
492
+
returnmap[string]any{
493
493
"username": loginVals.Username,
494
494
}, nil
495
495
}
@@ -650,7 +650,7 @@ This function should verify the user credentials given the gin context (i.e. pas
650
650
651
651
OPTIONAL: `PayloadFunc`
652
652
653
-
This function is called after having successfully authenticated (logged in). It should take whatever was returned from `Authenticator` and convert it into `MapClaims` (i.e. map[string]interface{}). A typical use case of this function is for when `Authenticator` returns a struct which holds the user identifiers, and that struct needs to be converted into a map. `MapClaims` should include one element that is [`IdentityKey` (default is "identity"): some_user_identity]. The elements of `MapClaims` returned in `PayloadFunc` will be embedded within the jwt token (as token claims). When users pass in their token on subsequent requests, you can get these claims back by using `ExtractClaims`.
653
+
This function is called after having successfully authenticated (logged in). It should take whatever was returned from `Authenticator` and convert it into `MapClaims` (i.e. map[string]any). A typical use case of this function is for when `Authenticator` returns a struct which holds the user identifiers, and that struct needs to be converted into a map. `MapClaims` should include one element that is [`IdentityKey` (default is "identity"): some_user_identity]. The elements of `MapClaims` returned in `PayloadFunc` will be embedded within the jwt token (as token claims). When users pass in their token on subsequent requests, you can get these claims back by using `ExtractClaims`.
0 commit comments