Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Federation Library
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ganggo
Federation Library
Commits
d172801c
Commit
d172801c
authored
Jan 19, 2018
by
zauberstuhl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support old xml webfinger request
parent
12749ba5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
30 deletions
+24
-30
webfinger.go
webfinger.go
+24
-30
No files found.
webfinger.go
View file @
d172801c
...
...
@@ -26,49 +26,43 @@ import (
type
WebFinger
struct
{
Host
string
Handle
string
Json
WebfingerJson
Data
WebfingerData
}
// TODO XML webfinger is deprecated but
// still used in host-meta which is required
// for a successful pod-active check
type
WebfingerXml
struct
{
XMLName
xml
.
Name
`xml:"XRD"`
Xmlns
string
`xml:"xmlns,attr"`
Subject
string
`xml:"Subject,omitempty"`
Alias
string
`xml:"Alias,omitempty"`
Links
[]
WebfingerXmlLink
`xml:"Link"`
}
type
WebfingerData
struct
{
// xml
XMLName
xml
.
Name
`xml:"XRD" json:"-"`
Xmlns
string
`xml:"xmlns,attr" json:"-"`
Alias
string
`xml:"Alias,omitempty" json:"-"`
// json
Aliases
[]
string
`json:"aliases" xml:"-"`
type
WebfingerXmlLink
struct
{
XMLName
xml
.
Name
`xml:"Link"`
Rel
string
`xml:"rel,attr"`
Type
string
`xml:"type,attr"`
Template
string
`xml:"template,attr,omitempty"`
Href
string
`xml:"href,attr,omitempty"`
Subject
string
`json:"subject" xml:"Subject,omitempty"`
Links
[]
WebfingerDataLink
`json:"links" xml:"Link"`
}
type
WebfingerJson
struct
{
Subject
string
`json:"subject"`
Aliases
[]
string
`json:"aliases"`
Links
[]
WebfingerJsonLink
`json:"links"`
}
type
WebfingerDataLink
struct
{
// xml
XMLName
xml
.
Name
`xml:"Link" json:"-"`
type
WebfingerJsonLink
struct
{
Rel
string
`json:"rel"`
Type
string
`json:"type,omitempty"`
Href
string
`json:"href,omitempty"`
Template
string
`json:"template,omitempty"`
Rel
string
`json:"rel" xml:"rel,attr"`
Type
string
`json:"type,omitempty" xml:"type,attr"`
Href
string
`json:"href,omitempty" xml:"href,attr,omitempty"`
Template
string
`json:"template,omitempty" xml:"template,attr,omitempty"`
}
func
(
w
*
WebFinger
)
Discovery
()
error
{
url
:=
fmt
.
Sprintf
(
"%s/.well-known/webfinger?resource=acct:%s"
,
w
.
Host
,
w
.
Handle
)
err
:=
FetchJson
(
"GET"
,
url
,
nil
,
&
w
.
Json
)
err
:=
FetchJson
(
"GET"
,
url
,
nil
,
&
w
.
Data
)
if
err
!=
nil
{
return
err
url
=
fmt
.
Sprintf
(
"%s/webfinger?q=acct:%s"
,
w
.
Host
,
w
.
Handle
)
err
=
FetchXml
(
"GET"
,
url
,
nil
,
&
w
.
Data
)
if
err
!=
nil
{
return
err
}
}
if
len
(
w
.
Json
.
Links
)
<
1
{
if
len
(
w
.
Data
.
Links
)
<
1
{
return
errors
.
New
(
"Webfinger Links missing"
)
}
return
nil
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment