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

Fix password flow #3196

Merged
merged 14 commits into from
Apr 23, 2024
8 changes: 8 additions & 0 deletions .chronus/changes/fix-password-flow-2024-3-19-16-22-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: fix
packages:
- "@typespec/http"
---

Fix password flow defining `authorizationUrl` instead of `tokenUrl`
12 changes: 6 additions & 6 deletions docs/libraries/http/reference/data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,12 @@ model TypeSpec.Http.PasswordFlow

#### Properties

| Name | Type | Description |
| ---------------- | --------------------------------------- | --------------------------------- |
| type | `TypeSpec.Http.OAuth2FlowType.password` | password flow |
| authorizationUrl | `string` | the authorization URL |
| refreshUrl? | `string` | the refresh URL |
| scopes? | `string[]` | list of scopes for the credential |
| Name | Type | Description |
| ----------- | --------------------------------------- | --------------------------------- |
| type | `TypeSpec.Http.OAuth2FlowType.password` | password flow |
| tokenUrl | `string` | the token URL |
| refreshUrl? | `string` | the refresh URL |
| scopes? | `string[]` | list of scopes for the credential |

### `PlainData` {#TypeSpec.Http.PlainData}

Expand Down
10 changes: 8 additions & 2 deletions eng/common/pipelines/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
trigger: none
trigger:
branches:
include:
- gh-readonly-queue/*

pr:
branches:
include:
- main
- gh-readonly-queue/*

extends:
template: /eng/common/pipelines/templates/1es-redirect.yml
Expand All @@ -19,6 +22,9 @@ extends:
- job: InitJob
displayName: Initialize
steps:
- script: node /eng/common/scripts/resolve-target-branch.js
displayName: Resolve target branch

- task: PowerShell@2
displayName: "Analyze PR changes"
name: InitStep
Expand Down
25 changes: 25 additions & 0 deletions eng/common/scripts/resolve-target-branch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// @ts-check
console.log("Process", process.env);
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed

const prTargetBranch = process.env["System_PullRequest_TargetBranch"];
const currentBranch = process.env["Build_SourceBranch"];

console.log("Branches:", {
prTargetBranch,
currentBranch,
});

if (prTargetBranch !== undefined) {
console.log("Target branch is", prTargetBranch);
console.log(`##vso[task.setvariable variable=TARGET_BRANCH]${prTargetBranch}`);
} else if (currentBranch) {
const segments = currentBranch.split("/");
if (segments[0] === "github-readonly-queue") {
const targetBranch = segments.slice(1, segments.length - 2).join("/");
console.log("Target branch is", targetBranch);
console.log(`##vso[task.setvariable variable=TARGET_BRANCH]${targetBranch}`);
}
} else {
console.log("Failed to resolve target branch.");
process.exit(1);
}
4 changes: 2 additions & 2 deletions packages/http/lib/auth.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ model PasswordFlow {
@doc("password flow")
type: OAuth2FlowType.password;

@doc("the authorization URL")
authorizationUrl: string;
@doc("the token URL")
tokenUrl: string;

@doc("the refresh URL")
refreshUrl?: string;
Expand Down
Loading