feat (auth): support for flow type authorization_code in oauth2-redirect.html (#6750)
This commit is contained in:
@@ -27,6 +27,14 @@ describe("oauth2", () => {
|
||||
authConfigs: {}
|
||||
}
|
||||
|
||||
let authConfig3 = {
|
||||
auth: { schema: { get: (key)=> mockSchema[key] }, scopes: Im.List(["scope4","scope5"]) },
|
||||
authActions: {},
|
||||
errActions: {},
|
||||
configs: { oauth2RedirectUrl: "" },
|
||||
authConfigs: {}
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
win.open = jest.fn()
|
||||
})
|
||||
@@ -114,5 +122,17 @@ describe("oauth2", () => {
|
||||
|
||||
windowOpenSpy.mockReset()
|
||||
})
|
||||
|
||||
it("should build authorize url for authorization_code flow", () => {
|
||||
const windowOpenSpy = jest.spyOn(win, "open")
|
||||
mockSchema.authorizationUrl = "https://testAuthorizationUrl"
|
||||
mockSchema.flow = "authorization_code"
|
||||
|
||||
oauth2Authorize(authConfig3)
|
||||
expect(windowOpenSpy.mock.calls.length).toEqual(1)
|
||||
expect(windowOpenSpy.mock.calls[0][0]).toMatch("https://testAuthorizationUrl?response_type=code&redirect_uri=&scope=scope4%20scope5&state=")
|
||||
|
||||
windowOpenSpy.mockReset()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user