-
Notifications
You must be signed in to change notification settings - Fork 658
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix(concourse): support old and new concourse auth Fixes concourse authentication for clusters >= v6.1.0 by detecting version and providing different implementation accordingly. Addresses issue: spinnaker/spinnaker#5797 * fix(concourse): support old and new concourse auth Sending basic auth header to /info endpoint causes 401 Addresses issue: spinnaker/spinnaker#5797 Co-authored-by: Jared Stehler <jared.stehler@edgenuity.com> Co-authored-by: Jared Stehler <jared.stehler@gmail.com> Co-authored-by: Jared Stehler <jared.stehler@edgenuity.com>
- Loading branch information
1 parent
9298b39
commit 4fe1326
Showing
11 changed files
with
322 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
igor-web/src/main/java/com/netflix/spinnaker/igor/concourse/client/ClusterInfoService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2019 Pivotal, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.igor.concourse.client; | ||
|
||
import com.netflix.spinnaker.igor.concourse.client.model.ClusterInfo; | ||
import retrofit.http.GET; | ||
|
||
public interface ClusterInfoService { | ||
@GET("/api/v1/info") | ||
ClusterInfo clusterInfo(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
igor-web/src/main/java/com/netflix/spinnaker/igor/concourse/client/SkyServiceV2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2019 Pivotal, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.igor.concourse.client; | ||
|
||
import retrofit.client.Response; | ||
import retrofit.http.GET; | ||
|
||
public interface SkyServiceV2 { | ||
@GET("/api/v1/user") | ||
Response userInfo(); | ||
} |
32 changes: 32 additions & 0 deletions
32
igor-web/src/main/java/com/netflix/spinnaker/igor/concourse/client/TokenServiceV2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2019 Pivotal, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.igor.concourse.client; | ||
|
||
import com.netflix.spinnaker.igor.concourse.client.model.TokenV2; | ||
import retrofit.http.Field; | ||
import retrofit.http.FormUrlEncoded; | ||
import retrofit.http.POST; | ||
|
||
public interface TokenServiceV2 { | ||
@FormUrlEncoded | ||
@POST("/sky/issuer/token") | ||
TokenV2 passwordToken( | ||
@Field("grant_type") String grantType, | ||
@Field("username") String username, | ||
@Field("password") String password, | ||
@Field("scope") String scope); | ||
} |
27 changes: 27 additions & 0 deletions
27
igor-web/src/main/java/com/netflix/spinnaker/igor/concourse/client/model/ClusterInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright 2019 Pivotal, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.igor.concourse.client.model; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class ClusterInfo { | ||
private String clusterName; | ||
private String externalUrl; | ||
private String version; | ||
private String workerVersion; | ||
} |
34 changes: 34 additions & 0 deletions
34
igor-web/src/main/java/com/netflix/spinnaker/igor/concourse/client/model/TokenV2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2019 Pivotal, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.igor.concourse.client.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.time.ZonedDateTime; | ||
|
||
public class TokenV2 extends Token { | ||
|
||
@Override | ||
@JsonProperty("id_token") | ||
public void setAccessToken(String idToken) { | ||
super.setAccessToken(idToken); | ||
} | ||
|
||
@Override | ||
public ZonedDateTime getExpiry() { | ||
return ZonedDateTime.now(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.