-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix oauth_authorization_url function call to undefined reference * Fix missing cache setup on conf dry run * Fix missing name log value * oidc block ttl attribute is optional now; with 1h default * Change: oauth2/oidc redirect_uri attribute gets evaluated per request now * Add shutdown logAll hook entries for failed tests * Remove obsolete method #247 * Add oidc eval test * fixup obsolete assignment * Fixup possible startup errors while fetching the oidc configuration Pass uid Fixed missing update of the jwt parser if the issuer has been changed * Change memCache set/get to interface{} value * Fixup missing lock on oidc configuration refresh * Renamed CallbackURL -> RedirectURI * Ensure that redirectURI is not empty * Handling of undefinied reference in saml_sso_url() similar to beta_oauth_authorization_url() * Do not load openid configuration at start-up; only GetVerifierMethod() and GetAuthorizationEndpoint() need uid, as they are the first methods calling the openid configuration * Reference() already in config.OIDC; removed from oidc.Config * split OAuth clients code into different files * better error log messages * removed unused return values * more information in OAuth2 error messages * renamed beta_oidc.ttl -> beta_oidc.configuration_ttl * missing optional configuration_ttl does not crash Co-authored-by: Johannes Koch <johannes.koch@avenga.com>
- Loading branch information
Marcel Ludwig
and
Johannes Koch
authored
Aug 20, 2021
1 parent
cab0670
commit 136c70d
Showing
47 changed files
with
998 additions
and
642 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
|
@@ -15,5 +15,5 @@ var Definitions = []*Error{ | |
|
||
AccessControl.Kind("saml2"), | ||
|
||
AccessControl.Kind("oauth2"), | ||
OAuth2.Kind("oauth2"), | ||
} |
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,44 @@ | ||
package content | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/hashicorp/hcl/v2" | ||
|
||
"github.com/avenga/couper/config/request" | ||
"github.com/avenga/couper/internal/seetie" | ||
) | ||
|
||
type Context interface { | ||
HCLContext() *hcl.EvalContext | ||
} | ||
|
||
func GetContextAttribute(context hcl.Body, httpContext context.Context, name string) (string, error) { | ||
ctx, ok := httpContext.Value(request.ContextType).(Context) | ||
if !ok { | ||
return "", nil | ||
} | ||
evalCtx := ctx.HCLContext() | ||
|
||
schema := &hcl.BodySchema{Attributes: []hcl.AttributeSchema{{Name: name}}} | ||
content, _, _ := context.PartialContent(schema) | ||
if content == nil || len(content.Attributes) == 0 { | ||
return "", nil | ||
} | ||
|
||
return GetAttribute(evalCtx, content, name) | ||
} | ||
|
||
func GetAttribute(ctx *hcl.EvalContext, content *hcl.BodyContent, name string) (string, error) { | ||
attr := content.Attributes | ||
if _, ok := attr[name]; !ok { | ||
return "", nil | ||
} | ||
|
||
val, diags := attr[name].Expr.Value(ctx) | ||
if diags.HasErrors() { | ||
return "", diags | ||
} | ||
|
||
return seetie.ValueToString(val), nil | ||
} |
Oops, something went wrong.