Skip to content

Commit

Permalink
Support passing idToken
Browse files Browse the repository at this point in the history
  • Loading branch information
abbradar committed Jun 27, 2024
1 parent 833be76 commit 309ecaa
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/components/EmbeddedContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
import { Vue, Prop, Watch, Component } from 'vue-property-decorator'
import { Embedded } from 'ozma-api'
import { namespace } from 'vuex-class'
import { Link, HrefTargetType, attrToQueryLink, linkHandler } from '../links'
import { CurrentAuth, INoAuth } from '@/state/auth'
type SupportedVecrsion = 0 | 1
Expand All @@ -27,6 +29,7 @@ type API1ClientRequestData =
| Embedded.IChangeHeightRequestData
| Embedded.IUpdateValueRequestData
| Embedded.IGotoRequestData
| Embedded.IIDTokenRequestData
// More restrictive than one from user views; for example, we don't allow actions.
const convertLink = (rawLink: Embedded.Link): Link | null => {
Expand Down Expand Up @@ -55,8 +58,11 @@ const convertLink = (rawLink: Embedded.Link): Link | null => {
return null
}
const auth = namespace('auth')
@Component
export default class EmbeddedContainer extends Vue {
@auth.State('current') currentAuth!: CurrentAuth | INoAuth | null
@Prop({ type: String }) src!: string | undefined
@Prop({ type: String }) srcdoc!: string | undefined
@Prop({ type: Boolean, default: false }) isControl!: boolean
Expand Down Expand Up @@ -151,6 +157,15 @@ export default class EmbeddedContainer extends Vue {
return { error: 'badRequest', message: 'Invalid link' }
}
},
idToken: (request: Embedded.IIDTokenRequestData) => {
if (!(this.currentAuth instanceof CurrentAuth)) {
return { result: {} };
} else {
return { result: {
idToken: this.currentAuth.idToken,
} }
}
},
})
return true
}
Expand Down

0 comments on commit 309ecaa

Please sign in to comment.