app.go 926 B

12345678910111213141516171819202122232425262728293031323334
  1. package sso
  2. /*
  3. app.go
  4. This file contains the app structure and app management
  5. functions for the SSO module.
  6. */
  7. // RegisteredUpstreamApp is a structure that contains the information of an
  8. // upstream app that is registered with the SSO server
  9. type RegisteredUpstreamApp struct {
  10. ID string
  11. Secret string
  12. Domain []string
  13. Scopes []string
  14. SessionDuration int //in seconds, default to 1 hour
  15. }
  16. // RegisterUpstreamApp registers an upstream app with the SSO server
  17. func (s *SSOHandler) ListRegisteredApps() []*RegisteredUpstreamApp {
  18. apps := make([]*RegisteredUpstreamApp, 0)
  19. for _, app := range s.Apps {
  20. apps = append(apps, &app)
  21. }
  22. return apps
  23. }
  24. // RegisterUpstreamApp registers an upstream app with the SSO server
  25. func (s *SSOHandler) GetAppByID(appID string) (*RegisteredUpstreamApp, bool) {
  26. app, ok := s.Apps[appID]
  27. return &app, ok
  28. }