Skip to content

Commit

Permalink
Remove dead code (#4328)
Browse files Browse the repository at this point in the history
The mobile apps cozy-drive and cozy-banks were able to onboard a new
Cozy instance. This was done with a flow involving the cloudery. Those
apps are no longer used, and the flow is no longer supported by the
cloudery, so we can clean the stack code.
  • Loading branch information
nono committed Feb 13, 2024
2 parents 2c11baa + fc4e1ae commit 21ff163
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 579 deletions.
135 changes: 0 additions & 135 deletions assets/scripts/check-deeplink.js

This file was deleted.

1 change: 0 additions & 1 deletion assets/templates/authorize.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,5 @@ <h1 class="h4 h2-md mb-3 text-center">{{t "Authorize Title" .Client.ClientName}}
</div>
<div class="modal-backdrop show"></div>
<script src="{{asset .Domain "/scripts/cirrus.js"}}"></script>
{{if .HasFallback}}<script src="{{asset .Domain "/scripts/check-deeplink.js"}}"></script>{{end}}
</body>
</html>
47 changes: 0 additions & 47 deletions docs/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -1002,53 +1002,6 @@ Content-Type: application/json
}
```

### POST /auth/secret_exchange

This endpoint is designed to trade a `secret` for a client. It is useful when an
OAuth client had been previously generated by an external entity with an
onboarding secret.

The only parameter needed is `secret`.


```http
POST /auth/secret_exchange HTTP/1.1
Host: cozy.example.org
Accept: application/json
Content-Type: application/json
{
"secret": "myS3Cr3t!"
}
```

```http
HTTP/1.1 200 OK
Content-Type: application/json
```

```json
{
"client_id": "cf60f07cd7e00d0c0f86cd3f29240477",
"client_secret": "NNSLTid18EATInQWyg2XGKd_vs0e3zUC",
"client_secret_expires_at": 0,
"redirect_uris": [
"https://example.org/oauth/callback"
],
"grant_types": [
"authorization_code",
"refresh_token"
],
"response_types": [
"code"
],
"client_name": "cozy-test-3",
"software_id": "github.com/cozy/cozy-test",
"notifications": null,
"onboarding_secret": "myS3Cr3t!"
}
```

### POST /auth/session_code

This endpoint can be used by the flagship application in order to create a
Expand Down
9 changes: 0 additions & 9 deletions model/oauth/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@ type Client struct {
CertifiedFromStore bool `json:"certified_from_store,omitempty"`
CreatedAtOnboarding bool `json:"created_at_onboarding,omitempty"`

OnboardingSecret string `json:"onboarding_secret,omitempty"`
OnboardingApp string `json:"onboarding_app,omitempty"`
OnboardingPermissions string `json:"onboarding_permissions,omitempty"`
OnboardingState string `json:"onboarding_state,omitempty"`

Metadata *metadata.CozyMetadata `json:"cozyMetadata,omitempty"`
}

Expand Down Expand Up @@ -592,10 +587,6 @@ func (c *Client) Update(i *instance.Instance, old *Client) *ClientRegistrationEr
c.GrantTypes = []string{"authorization_code", "refresh_token"}
c.ResponseTypes = []string{"code"}
c.AllowLoginScope = old.AllowLoginScope
c.OnboardingSecret = ""
c.OnboardingApp = ""
c.OnboardingPermissions = ""
c.OnboardingState = ""

if c.ClientName != old.ClientName {
if err := c.ensureClientNameUnicity(i); err != nil {
Expand Down
1 change: 0 additions & 1 deletion web/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,6 @@ func Routes(router *echo.Group) {
authHandler.Register(router.Group("/authorize", noCSRF))

router.POST("/access_token", accessToken)
router.POST("/secret_exchange", secretExchange)

// Flagship app
router.POST("/session_code", CreateSessionCode)
Expand Down
Loading

0 comments on commit 21ff163

Please sign in to comment.