Skip to content

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

Draft
tlanfer wants to merge 5 commits intod-velop:mainfrom
tlanfer:feature/idp-app-session
Draft

Add support for using "app sessions" with the d.ecs identityprovider#11
tlanfer wants to merge 5 commits intod-velop:mainfrom
tlanfer:feature/idp-app-session

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