-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c22e343
commit f137849
Showing
11 changed files
with
108 additions
and
108 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,34 @@ | ||
## Fork | ||
|
||
This is a hard fork of [ORY Fosite](https://github.com/ory/fosite) under the [Apache 2.0 License](LICENSE) for the | ||
purpose of performing self-maintenance of this critical dependency. | ||
This is a hard fork of [ORY Fosite](https://github.com/ory/fosite) under the | ||
[Apache 2.0 License](LICENSE) for the purpose of performing self-maintenance of | ||
this critical dependency. | ||
|
||
We however: | ||
|
||
* Acknowledge the amazing hard work of the ORY developers in making such an amazing framework that we can do this with. | ||
* Plan to continue to contribute back to te ORY Fosite and related projects. | ||
* Have ensured the licensing is unchanged in this fork of the library. | ||
* Do not have a formal affiliation with ORY and individuals utilizing this library should not allow their usage to be | ||
a reflection on ORY as this library is not maintained by them. | ||
- Acknowledge the amazing hard work of the ORY developers in making such an | ||
amazing framework that we can do this with. | ||
- Plan to continue to contribute back to te ORY Fosite and related projects. | ||
- Have ensured the licensing is unchanged in this fork of the library. | ||
- Do not have a formal affiliation with ORY and individuals utilizing this | ||
library should not allow their usage to be a reflection on ORY as this library | ||
is not maintained by them. | ||
|
||
## Notable Differences | ||
|
||
In an effort to assist users who wish to use this library we aim to maintain the following list of differences: | ||
In an effort to assist users who wish to use this library we aim to maintain the | ||
following list of differences: | ||
|
||
* Module path changed from `github.com/ory/fosite` to `github.com/authelia/oauth2`. | ||
* Minimum dependency is go version 1.21. | ||
* Removal of the following dependencies: | ||
* `go.opentelemetry.io/otel` | ||
* Migration of the following dependencies: | ||
* `github.com/golang/mock` => `github.com/uber-go/mock` | ||
- Module path changed from `github.com/ory/fosite` to | ||
`github.com/authelia/oauth2`. | ||
- Minimum dependency is go version 1.21. | ||
- Removal of the following dependencies: | ||
- `go.opentelemetry.io/otel` | ||
- Migration of the following dependencies: | ||
- `github.com/golang/mock` => `github.com/uber-go/mock` | ||
|
||
## TODO | ||
|
||
* Consolidate JWT and JOSE dependencies | ||
* Remove unecessary dependencies and/or abstract them | ||
* Apply downstream fixes | ||
- Consolidate JWT and JOSE dependencies | ||
- Remove unecessary dependencies and/or abstract them | ||
- Apply downstream fixes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package reflection | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"reflect" | ||
) | ||
|
||
func GetField(obj interface{}, name string) (interface{}, error) { | ||
if !hasValidType(obj, []reflect.Kind{reflect.Struct, reflect.Ptr}) { | ||
return nil, errors.New("Cannot use GetField on a non-struct interface") | ||
} | ||
|
||
objValue := reflectValue(obj) | ||
field := objValue.FieldByName(name) | ||
if !field.IsValid() { | ||
return nil, fmt.Errorf("No such field: %s in obj", name) | ||
} | ||
|
||
return field.Interface(), nil | ||
} | ||
|
||
func hasValidType(obj interface{}, types []reflect.Kind) bool { | ||
for _, t := range types { | ||
if reflect.TypeOf(obj).Kind() == t { | ||
return true | ||
} | ||
} | ||
|
||
return false | ||
} | ||
|
||
func reflectValue(obj interface{}) reflect.Value { | ||
var val reflect.Value | ||
|
||
if reflect.TypeOf(obj).Kind() == reflect.Ptr { | ||
val = reflect.ValueOf(obj).Elem() | ||
} else { | ||
val = reflect.ValueOf(obj) | ||
} | ||
|
||
return val | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters