Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for using "app sessions" with the d.ecs identityprovider #11

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Add support for using "app sessions" with the d.ecs identityprovider #11

wants to merge 5 commits into from

Conversation

tlanfer
Copy link
Contributor

@tlanfer tlanfer commented Aug 29, 2019

This pull request implements support to use "app sessions" with the d.ecs identityprovider.

To use this in you app, you can either retrieve a full scim.Principal and as the sdk if its an app principal. This might be useful if your ressource can be called from both apps and real users.

principal = idp.PrincipalFromCtx(request.Context())
appName, isApp := principal.App()

if isApp {
	log.Infof(request.Context(), "Hello app %v", appName)
} else {
	log.Infof(request.Context(), "Hello user %v", principal.UserName)
}

Or, if your ressource is only ever to be used using an app principal, ask explicitly for that.

appName, isApp := idp.AppFromCtx(context.Background())

if isApp {
	log.Infof(request.Context(), "Hello App %v", appName)
} else {
	panic("illegal session") // bad idea
}

@tlanfer tlanfer requested a review from mtestrot August 29, 2019 07:24
@mtestrot mtestrot added the enhancement New feature or request label Sep 3, 2019
@d-velop-github-admin d-velop-github-admin changed the base branch from master to main December 1, 2022 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants