Compare commits
85 Commits
chart
...
078aae8172
| Author | SHA1 | Date | |
|---|---|---|---|
| 078aae8172 | |||
| 048707bfe5 | |||
| 5f7289bb05 | |||
| 484154a48d | |||
| af0a8cb117 | |||
| eb6dee0c4d | |||
| b8b0743af5 | |||
| 28c08d0873 | |||
| eef21ad537 | |||
| 492aff13a3 | |||
| 627058fcab | |||
| 1acd2ea634 | |||
| a897f5aa75 | |||
| 64b8da67f2 | |||
| 5512cc76c3 | |||
| 7d3cb1af61 | |||
| b18718cb47 | |||
| 3f245b3f02 | |||
| 980fd50cf5 | |||
| 02476ca07d | |||
| f56b947e1f | |||
| 0e86777fd3 | |||
| 6b9e21b929 | |||
| 365d62a64e | |||
| 076dca0a1d | |||
| e1cb9b3a08 | |||
| 7127dc9010 | |||
| 1f4b25c594 | |||
| f93371e449 | |||
| 013c6969c5 | |||
| 403deaf65b | |||
| 9d0b720231 | |||
| 932e40190d | |||
| f226866fc7 | |||
| b154532a1a | |||
| a546c1220e | |||
| fb3366328b | |||
| 75857dc125 | |||
| e7ff288972 | |||
| d83208be52 | |||
| 3d42ce6820 | |||
| 5ca9a10d14 | |||
| a480c9b8a0 | |||
| 6a6fe77c30 | |||
| 2f8524af01 | |||
| b684ba841f | |||
| 37a0ceddf4 | |||
| b18b82ea8c | |||
| 9bb08fc961 | |||
| cf08618f83 | |||
| 0989aeb979 | |||
| 8f4e33ab80 | |||
| 8df956bdcd | |||
| 776aac5d43 | |||
| b84c2ef353 | |||
| 27e2df2310 | |||
| 939c8cdd67 | |||
| 2a794518d5 | |||
| 4498afabac | |||
| f10615888c | |||
| 2ce3a380f0 | |||
| 36e843d343 | |||
| 3a30e265cf | |||
| 4add83b0d6 | |||
| fd65220b91 | |||
| 1722980514 | |||
| 01daaae766 | |||
| be071ec328 | |||
| 9a86604564 | |||
| cc91341547 | |||
| 2a8349b0c7 | |||
| f4154136e1 | |||
| c73bd264cb | |||
| d229d92b3b | |||
| 8b8e5d92d7 | |||
| 828122a5a9 | |||
| 605327e5c7 | |||
| 02767d87fa | |||
| 2ca16c07b3 | |||
| d33d2eb343 | |||
| d87883b57f | |||
| 7198c40d30 | |||
|
|
05c4aab72a | ||
|
|
cb2c631fb4 | ||
|
|
9bb7cd77c0 |
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Force Go as the main language
|
||||||
|
*.go linguist-detectable=true
|
||||||
|
* linguist-language=Go
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -20,4 +20,4 @@
|
|||||||
|
|
||||||
# Go workspace file
|
# Go workspace file
|
||||||
go.work
|
go.work
|
||||||
|
env.env
|
||||||
50
Dockerfile
50
Dockerfile
@@ -1,29 +1,43 @@
|
|||||||
FROM golang:alpine as builder
|
FROM golang:alpine AS deps
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN sed -i '/replace/d' go.mod
|
||||||
|
RUN cat go.mod
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
FROM golang:alpine AS builder
|
||||||
|
|
||||||
|
RUN go install github.com/beego/bee/v2@latest
|
||||||
|
|
||||||
|
WORKDIR /oc-auth
|
||||||
|
|
||||||
|
COPY --from=deps /go/pkg /go/pkg
|
||||||
|
COPY --from=deps /app/go.mod /app/go.sum ./
|
||||||
|
|
||||||
|
RUN export CGO_ENABLED=0 && \
|
||||||
|
export GOOS=linux && \
|
||||||
|
export GOARCH=amd64 && \
|
||||||
|
export BUILD_FLAGS="-ldflags='-w -s'"
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN apk add git
|
RUN sed -i '/replace/d' go.mod
|
||||||
|
RUN bee pack
|
||||||
|
RUN mkdir -p /app/extracted && tar -zxvf oc-auth.tar.gz -C /app/extracted
|
||||||
|
RUN sed -i 's/http:\/\/127.0.0.1:8080\/swagger\/swagger.json/swagger.json/g' /app/extracted/swagger/index.html
|
||||||
|
|
||||||
RUN go get github.com/beego/bee/v2 && go install github.com/beego/bee/v2@master
|
#----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
RUN timeout 15 bee run -gendoc=true -downdoc=true -runmode=dev || :
|
FROM golang:alpine
|
||||||
|
|
||||||
RUN sed -i 's/http:\/\/127.0.0.1:8080\/swagger\/swagger.json/swagger.json/g' swagger/index.html
|
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" .
|
|
||||||
|
|
||||||
RUN ls /app
|
|
||||||
|
|
||||||
FROM scratch
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY --from=builder /app/extracted/oc-auth /usr/bin
|
||||||
COPY --from=builder /app/oc-auth /usr/bin/
|
COPY --from=builder /app/extracted/swagger /app/swagger
|
||||||
COPY --from=builder /app/swagger /app/swagger
|
COPY --from=builder /app/extracted/pem /app/pem
|
||||||
|
COPY --from=builder /app/extracted/docker_auth.json /etc/oc/auth.json
|
||||||
COPY docker_auth.json /etc/oc/auth.json
|
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
|||||||
9
LICENSE
9
LICENSE
@@ -1,9 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) <year> <copyright holders>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
660
LICENSE.md
Normal file
660
LICENSE.md
Normal file
@@ -0,0 +1,660 @@
|
|||||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
<https://fsf.org/>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this
|
||||||
|
license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
## Preamble
|
||||||
|
|
||||||
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains
|
||||||
|
free software for all its users.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights
|
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
|
and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that
|
||||||
|
improvements made in alternate versions of the program, if they
|
||||||
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and
|
||||||
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
|
released a new version of the Affero GPL which permits relicensing
|
||||||
|
under this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
## TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
### 0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public
|
||||||
|
License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds
|
||||||
|
of works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of
|
||||||
|
an exact copy. The resulting work is called a "modified version" of
|
||||||
|
the earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user
|
||||||
|
through a computer network, with no transfer of a copy, is not
|
||||||
|
conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices" to
|
||||||
|
the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
### 1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. "Object code" means any non-source form of
|
||||||
|
a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users can
|
||||||
|
regenerate automatically from other parts of the Corresponding Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that same
|
||||||
|
work.
|
||||||
|
|
||||||
|
### 2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not convey,
|
||||||
|
without conditions so long as your license otherwise remains in force.
|
||||||
|
You may convey covered works to others for the sole purpose of having
|
||||||
|
them make modifications exclusively for you, or provide you with
|
||||||
|
facilities for running those works, provided that you comply with the
|
||||||
|
terms of this License in conveying all material for which you do not
|
||||||
|
control copyright. Those thus making or running the covered works for
|
||||||
|
you must do so exclusively on your behalf, under your direction and
|
||||||
|
control, on terms that prohibit them from making any copies of your
|
||||||
|
copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under the
|
||||||
|
conditions stated below. Sublicensing is not allowed; section 10 makes
|
||||||
|
it unnecessary.
|
||||||
|
|
||||||
|
### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such
|
||||||
|
circumvention is effected by exercising rights under this License with
|
||||||
|
respect to the covered work, and you disclaim any intention to limit
|
||||||
|
operation or modification of the work as a means of enforcing, against
|
||||||
|
the work's users, your or third parties' legal rights to forbid
|
||||||
|
circumvention of technological measures.
|
||||||
|
|
||||||
|
### 4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
### 5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
- a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
- b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under
|
||||||
|
section 7. This requirement modifies the requirement in section 4
|
||||||
|
to "keep intact all notices".
|
||||||
|
- c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
- d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
### 6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms of
|
||||||
|
sections 4 and 5, provided that you also convey the machine-readable
|
||||||
|
Corresponding Source under the terms of this License, in one of these
|
||||||
|
ways:
|
||||||
|
|
||||||
|
- a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
- b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the Corresponding
|
||||||
|
Source from a network server at no charge.
|
||||||
|
- c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
- d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
- e) Convey the object code using peer-to-peer transmission,
|
||||||
|
provided you inform other peers where the object code and
|
||||||
|
Corresponding Source of the work are being offered to the general
|
||||||
|
public at no charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal,
|
||||||
|
family, or household purposes, or (2) anything designed or sold for
|
||||||
|
incorporation into a dwelling. In determining whether a product is a
|
||||||
|
consumer product, doubtful cases shall be resolved in favor of
|
||||||
|
coverage. For a particular product received by a particular user,
|
||||||
|
"normally used" refers to a typical or common use of that class of
|
||||||
|
product, regardless of the status of the particular user or of the way
|
||||||
|
in which the particular user actually uses, or expects or is expected
|
||||||
|
to use, the product. A product is a consumer product regardless of
|
||||||
|
whether the product has substantial commercial, industrial or
|
||||||
|
non-consumer uses, unless such uses represent the only significant
|
||||||
|
mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to
|
||||||
|
install and execute modified versions of a covered work in that User
|
||||||
|
Product from a modified version of its Corresponding Source. The
|
||||||
|
information must suffice to ensure that the continued functioning of
|
||||||
|
the modified object code is in no case prevented or interfered with
|
||||||
|
solely because modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or
|
||||||
|
updates for a work that has been modified or installed by the
|
||||||
|
recipient, or for the User Product in which it has been modified or
|
||||||
|
installed. Access to a network may be denied when the modification
|
||||||
|
itself materially and adversely affects the operation of the network
|
||||||
|
or violates the rules and protocols for communication across the
|
||||||
|
network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
### 7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders
|
||||||
|
of that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
- a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
- b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
- c) Prohibiting misrepresentation of the origin of that material,
|
||||||
|
or requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
- d) Limiting the use for publicity purposes of names of licensors
|
||||||
|
or authors of the material; or
|
||||||
|
- e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
- f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions
|
||||||
|
of it) with contractual assumptions of liability to the recipient,
|
||||||
|
for any liability that these contractual assumptions directly
|
||||||
|
impose on those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions; the
|
||||||
|
above requirements apply either way.
|
||||||
|
|
||||||
|
### 8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your license
|
||||||
|
from a particular copyright holder is reinstated (a) provisionally,
|
||||||
|
unless and until the copyright holder explicitly and finally
|
||||||
|
terminates your license, and (b) permanently, if the copyright holder
|
||||||
|
fails to notify you of the violation by some reasonable means prior to
|
||||||
|
60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
### 9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or run
|
||||||
|
a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
### 10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
### 11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims owned
|
||||||
|
or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within the
|
||||||
|
scope of its coverage, prohibits the exercise of, or is conditioned on
|
||||||
|
the non-exercise of one or more of the rights that are specifically
|
||||||
|
granted under this License. You may not convey a covered work if you
|
||||||
|
are a party to an arrangement with a third party that is in the
|
||||||
|
business of distributing software, under which you make payment to the
|
||||||
|
third party based on the extent of your activity of conveying the
|
||||||
|
work, and under which the third party grants, to any of the parties
|
||||||
|
who would receive the covered work from you, a discriminatory patent
|
||||||
|
license (a) in connection with copies of the covered work conveyed by
|
||||||
|
you (or copies made from those copies), or (b) primarily for and in
|
||||||
|
connection with specific products or compilations that contain the
|
||||||
|
covered work, unless you entered into that arrangement, or that patent
|
||||||
|
license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
### 12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under
|
||||||
|
this License and any other pertinent obligations, then as a
|
||||||
|
consequence you may not convey it at all. For example, if you agree to
|
||||||
|
terms that obligate you to collect a royalty for further conveying
|
||||||
|
from those to whom you convey the Program, the only way you could
|
||||||
|
satisfy both those terms and this License would be to refrain entirely
|
||||||
|
from conveying the Program.
|
||||||
|
|
||||||
|
### 13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your
|
||||||
|
version supports such interaction) an opportunity to receive the
|
||||||
|
Corresponding Source of your version by providing access to the
|
||||||
|
Corresponding Source from a network server at no charge, through some
|
||||||
|
standard or customary means of facilitating copying of software. This
|
||||||
|
Corresponding Source shall include the Corresponding Source for any
|
||||||
|
work covered by version 3 of the GNU General Public License that is
|
||||||
|
incorporated pursuant to the following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
### 14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Affero General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever
|
||||||
|
published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future versions
|
||||||
|
of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
### 15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
|
||||||
|
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
|
||||||
|
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
|
||||||
|
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||||
|
CORRECTION.
|
||||||
|
|
||||||
|
### 16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
|
||||||
|
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||||
|
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
|
||||||
|
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
|
||||||
|
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
|
||||||
|
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||||
|
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
### 17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
## How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these
|
||||||
|
terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest to
|
||||||
|
attach them to the start of each source file to most effectively state
|
||||||
|
the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper
|
||||||
|
mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for
|
||||||
|
the specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. For more information on this, and how to apply and follow
|
||||||
|
the GNU AGPL, see <https://www.gnu.org/licenses/>.
|
||||||
42
Makefile
Normal file
42
Makefile
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
.DEFAULT_GOAL := all
|
||||||
|
|
||||||
|
build: clean
|
||||||
|
bee pack
|
||||||
|
|
||||||
|
run:
|
||||||
|
bee run -gendoc=true -downdoc=true
|
||||||
|
|
||||||
|
purge:
|
||||||
|
lsof -t -i:8094 | xargs kill | true
|
||||||
|
|
||||||
|
run-dev:
|
||||||
|
bee generate routers && bee run -gendoc=true -downdoc=true -runmode=prod
|
||||||
|
|
||||||
|
dev: purge run-dev
|
||||||
|
|
||||||
|
debug:
|
||||||
|
bee run -downdebug -gendebug
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf oc-auth oc-auth.tar.gz
|
||||||
|
|
||||||
|
docker:
|
||||||
|
DOCKER_BUILDKIT=1 docker build -t oc-auth -f Dockerfile . --build-arg=HOST=$(HOST)
|
||||||
|
docker tag oc-auth opencloudregistry/oc-auth:latest
|
||||||
|
|
||||||
|
publish-kind:
|
||||||
|
kind load docker-image opencloudregistry/oc-auth:latest --name $(CLUSTER_NAME) | true
|
||||||
|
|
||||||
|
publish-registry:
|
||||||
|
docker push opencloudregistry/oc-auth:latest
|
||||||
|
|
||||||
|
docker-deploy:
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
run-docker: docker publish-kind publish-registry docker-deploy
|
||||||
|
|
||||||
|
all: docker publish-kind
|
||||||
|
|
||||||
|
ci: docker publish-registry
|
||||||
|
|
||||||
|
.PHONY: build run clean docker publish-kind publish-registry
|
||||||
69
README.md
69
README.md
@@ -7,7 +7,76 @@ To build :
|
|||||||
bee generate routers
|
bee generate routers
|
||||||
bee run -gendoc=true -downdoc=true
|
bee run -gendoc=true -downdoc=true
|
||||||
|
|
||||||
|
OR
|
||||||
|
make dev
|
||||||
|
|
||||||
If default Swagger page is displayed instead of tyour api, change url in swagger/index.html file to :
|
If default Swagger page is displayed instead of tyour api, change url in swagger/index.html file to :
|
||||||
|
|
||||||
url: "swagger.json"
|
url: "swagger.json"
|
||||||
|
|
||||||
|
|
||||||
|
┌─────────┐ ┌──────────┐ ┌────────────┐ ┌────────┐
|
||||||
|
│ Browser │ │ UI │ │ Hydra │ │ API │
|
||||||
|
└────┬────┘ └────┬─────┘ └────┬───────┘ └───┬────┘
|
||||||
|
│ │ │ │
|
||||||
|
│ 1. Click "Login" │ │ │
|
||||||
|
│─────────────────► │ │ │
|
||||||
|
│ │ │ │
|
||||||
|
│ 2. Redirect auth │──────────────────► │ │
|
||||||
|
│ │ /oauth2/auth │ │
|
||||||
|
│ │ │ │
|
||||||
|
│ │ ◄──────────────────│ │
|
||||||
|
│ │ login challenge │ │
|
||||||
|
│ │ │ │
|
||||||
|
│ │ 3. Login UI │ │
|
||||||
|
│ │ (credentials) │ │
|
||||||
|
│ │ │ │
|
||||||
|
│ │──────────────────► │ │
|
||||||
|
│ │ accept login │ │
|
||||||
|
│ │ │ │
|
||||||
|
│ │ ◄──────────────────│ │
|
||||||
|
│ │ consent challenge │ │
|
||||||
|
│ │ │ │
|
||||||
|
│ │ 4. CALL API │ │
|
||||||
|
│ │──────────────────────────────────────► │
|
||||||
|
│ │ fetch peer / roles │
|
||||||
|
│ │ │ │
|
||||||
|
│ │ ◄──────────────────────────────────────│
|
||||||
|
│ │ peer, permissions │
|
||||||
|
│ │ │ │
|
||||||
|
│ │ 5. Accept consent │ │
|
||||||
|
│ │──────────────────► │ │
|
||||||
|
│ │ + custom claims │ │
|
||||||
|
│ │ │ │
|
||||||
|
│ │ ◄──────────────────│ │
|
||||||
|
│ │ redirect w/ code │ │
|
||||||
|
│ │ │ │
|
||||||
|
│ 6. Exchange code │──────────────────► │ │
|
||||||
|
│ for token │ /oauth2/token │ │
|
||||||
|
│ │ │ │
|
||||||
|
│ ◄─────────────────│ │ │
|
||||||
|
│ 7. JWT access_token │ │
|
||||||
|
│ (signed + enriched) │
|
||||||
|
│ │
|
||||||
|
│ 8. API call with Bearer token │
|
||||||
|
│───────────────────────────────────────────────────────────►│
|
||||||
|
│ │
|
||||||
|
│ ◄──────────────────────────────────────────────────────────│
|
||||||
|
|
||||||
|
Browser
|
||||||
|
↓
|
||||||
|
Hydra /oauth2/auth
|
||||||
|
↓
|
||||||
|
Redirect → /login?login_challenge=abc123
|
||||||
|
↓
|
||||||
|
Frontend Login Page
|
||||||
|
↓
|
||||||
|
POST username/password/login_challenge
|
||||||
|
↓
|
||||||
|
TON backend
|
||||||
|
↓
|
||||||
|
Hydra Admin API (accept login)
|
||||||
|
↓
|
||||||
|
Hydra retourne redirect_to
|
||||||
|
↓
|
||||||
|
Frontend redirige
|
||||||
|
|||||||
7
auth.json
Normal file
7
auth.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"MONGO_URL":"mongodb://localhost:27017/",
|
||||||
|
"MONGO_DATABASE":"DC_myDC",
|
||||||
|
"NATS_URL": "nats://localhost:4222",
|
||||||
|
"LDAP_ENDPOINTS": "localhost:390",
|
||||||
|
"port": 8094
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
appname = oc-auth
|
appname = oc-auth
|
||||||
httpport = 8080
|
httpport = 8094
|
||||||
runmode = dev
|
runmode = dev
|
||||||
autorender = false
|
autorender = false
|
||||||
copyrequestbody = true
|
copyrequestbody = true
|
||||||
|
|||||||
@@ -3,10 +3,34 @@ package conf
|
|||||||
import "sync"
|
import "sync"
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
NatsUrl string
|
SourceMode string
|
||||||
NatsLogin string
|
AdminRole string
|
||||||
NatsPassword string
|
PublicKeyPath string
|
||||||
OidcUrl string
|
PrivateKeyPath string
|
||||||
|
|
||||||
|
LDAPEndpoints string
|
||||||
|
LDAPBindDN string
|
||||||
|
LDAPBindPW string
|
||||||
|
LDAPBaseDN string
|
||||||
|
LDAPUserBaseDN string
|
||||||
|
LDAPRoleBaseDN string
|
||||||
|
|
||||||
|
ClientSecret string
|
||||||
|
OAuth2ClientSecretName string
|
||||||
|
OAuth2ClientSecretNamespace string
|
||||||
|
|
||||||
|
Auth string
|
||||||
|
AuthConnectPublicHost string
|
||||||
|
AuthConnectorHost string
|
||||||
|
AuthConnectorPort int
|
||||||
|
AuthConnectorAdminPort string
|
||||||
|
|
||||||
|
PermissionConnectorWriteHost string
|
||||||
|
PermissionConnectorReadHost string
|
||||||
|
PermissionConnectorPort string
|
||||||
|
PermissionConnectorAdminPort string
|
||||||
|
|
||||||
|
Local bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var instance *Config
|
var instance *Config
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
package controllers
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
beego "github.com/beego/beego/v2/server/web"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Operations about auth
|
|
||||||
type AuthController struct {
|
|
||||||
beego.Controller
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Title Create
|
|
||||||
// @Description create auths
|
|
||||||
// @Param body body []models.auth true "The auth content"
|
|
||||||
// @Success 200 {string} models.auth.Id
|
|
||||||
// @Failure 403 body is empty
|
|
||||||
// @router / [post]
|
|
||||||
func (o *AuthController) Post() {
|
|
||||||
// store and return Id or post with UUID
|
|
||||||
o.Data["json"] = map[string]string{"Id": "?"}
|
|
||||||
o.ServeJSON()
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Title Get
|
|
||||||
// @Description find auth by authid
|
|
||||||
// @Param authId path string true "the authid you want to get"
|
|
||||||
// @Success 200 {auth} models.auth
|
|
||||||
// @Failure 403 :authId is empty
|
|
||||||
// @router /:authId [get]
|
|
||||||
func (o *AuthController) Get() {
|
|
||||||
authId := o.Ctx.Input.Param(":authId")
|
|
||||||
fmt.Println(authId)
|
|
||||||
o.ServeJSON()
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Title Find
|
|
||||||
// @Description find auths with query
|
|
||||||
// @Param query path string true "the keywords you need"
|
|
||||||
// @Success 200 {auths} []models.auth
|
|
||||||
// @Failure 403
|
|
||||||
// @router /find/:query [get]
|
|
||||||
func (o *AuthController) Find() {
|
|
||||||
query := o.Ctx.Input.Param(":query")
|
|
||||||
fmt.Println(query)
|
|
||||||
o.ServeJSON()
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Title Delete
|
|
||||||
// @Description delete the auth
|
|
||||||
// @Param authId path string true "The authId you want to delete"
|
|
||||||
// @Success 200 {string} delete success!
|
|
||||||
// @Failure 403 authId is empty
|
|
||||||
// @router /:authId [delete]
|
|
||||||
func (o *AuthController) Delete() {
|
|
||||||
authId := o.Ctx.Input.Param(":authId")
|
|
||||||
fmt.Println(authId)
|
|
||||||
o.ServeJSON()
|
|
||||||
}
|
|
||||||
221
controllers/group.go
Normal file
221
controllers/group.go
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
package controllers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"oc-auth/infrastructure"
|
||||||
|
|
||||||
|
beego "github.com/beego/beego/v2/server/web"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Operations about auth
|
||||||
|
type GroupController struct {
|
||||||
|
beego.Controller
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Create
|
||||||
|
// @Description create group
|
||||||
|
// @Param id path string true "the id you want to get"
|
||||||
|
// @Success 200 {auth} create success!
|
||||||
|
// @router /:id [post]
|
||||||
|
func (o *GroupController) Post() {
|
||||||
|
// store and return Id or post with UUID
|
||||||
|
id := o.Ctx.Input.Param(":id")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
group, code, err := infrastructure.GetPermissionConnector(clientID).CreateGroup(id)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": code,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": group,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title GetByUser
|
||||||
|
// @Description find group by user id
|
||||||
|
// @Param id path string true "the id you want to get"
|
||||||
|
// @Success 200 {auth} string
|
||||||
|
// @router /user/:id [get]
|
||||||
|
func (o *GroupController) GetByUser() {
|
||||||
|
id := o.Ctx.Input.Param(":id")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
group, err := infrastructure.GetPermissionConnector(clientID).GetGroupByUser(id)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": group,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title GetAll
|
||||||
|
// @Description find groups
|
||||||
|
// @Success 200 {group} string
|
||||||
|
// @router / [get]
|
||||||
|
func (o *GroupController) GetAll() {
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
group, err := infrastructure.GetPermissionConnector(clientID).GetGroup("")
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": group,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Get
|
||||||
|
// @Description find group by id
|
||||||
|
// @Param id path string true "the id you want to get"
|
||||||
|
// @Success 200 {group} string
|
||||||
|
// @router /:id [get]
|
||||||
|
func (o *GroupController) Get() {
|
||||||
|
id := o.Ctx.Input.Param(":id")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
group, err := infrastructure.GetPermissionConnector(clientID).GetGroup(id)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": group,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Delete
|
||||||
|
// @Description delete the group
|
||||||
|
// @Param id path string true "The id you want to delete"
|
||||||
|
// @Success 200 {string} delete success!
|
||||||
|
// @router /:id [delete]
|
||||||
|
func (o *GroupController) Delete() {
|
||||||
|
id := o.Ctx.Input.Param(":id")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
group, code, err := infrastructure.GetPermissionConnector(clientID).DeleteGroup(id)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": code,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": group,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Clear
|
||||||
|
// @Description clear the group
|
||||||
|
// @Success 200 {string} delete success!
|
||||||
|
// @router /clear [delete]
|
||||||
|
func (o *GroupController) Clear() {
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
group, code, err := infrastructure.GetPermissionConnector(clientID).DeleteGroup("")
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": code,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": group,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Bind
|
||||||
|
// @Description bind the group to user
|
||||||
|
// @Param user_id path string true "The user_id you want to bind"
|
||||||
|
// @Param group_id path string true "The group_id you want to bind"
|
||||||
|
// @Success 200 {string} bind success!
|
||||||
|
// @router /:user_id/:group_id [post]
|
||||||
|
func (o *GroupController) Bind() {
|
||||||
|
user_id := o.Ctx.Input.Param(":user_id")
|
||||||
|
group_id := o.Ctx.Input.Param(":group_id")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
group, code, err := infrastructure.GetPermissionConnector(clientID).BindGroup(user_id, group_id)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": code,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": group,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title UnBind
|
||||||
|
// @Description unbind the group to user
|
||||||
|
// @Param user_id path string true "The group_id you want to unbind"
|
||||||
|
// @Param group_id path string true "The user_id you want to unbind"
|
||||||
|
// @Success 200 {string} bind success!
|
||||||
|
// @router /:user_id/:group_id [delete]
|
||||||
|
func (o *GroupController) UnBind() {
|
||||||
|
user_id := o.Ctx.Input.Param(":user_id")
|
||||||
|
group_id := o.Ctx.Input.Param(":group_id")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
group, code, err := infrastructure.GetPermissionConnector(clientID).UnBindGroup(user_id, group_id)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": code,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": group,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
518
controllers/oauth2.go
Normal file
518
controllers/oauth2.go
Normal file
@@ -0,0 +1,518 @@
|
|||||||
|
package controllers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/base64"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"oc-auth/conf"
|
||||||
|
"oc-auth/infrastructure"
|
||||||
|
auth_connectors "oc-auth/infrastructure/auth_connector"
|
||||||
|
"regexp"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
oclib "cloud.o-forge.io/core/oc-lib"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/peer"
|
||||||
|
model "cloud.o-forge.io/core/oc-lib/models/peer"
|
||||||
|
beego "github.com/beego/beego/v2/server/web"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OAuthController handles OAuth2 login/consent provider endpoints
|
||||||
|
type OAuthController struct {
|
||||||
|
beego.Controller
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title GetLogin
|
||||||
|
// @Description Hydra redirects here with a login_challenge. Returns challenge info or auto-accepts if session exists.
|
||||||
|
// @Param login_challenge query string true "The login challenge from Hydra"
|
||||||
|
// @Success 200 {object} auth_connectors.LoginChallenge
|
||||||
|
// @Failure 400 missing login_challenge
|
||||||
|
// @Failure 500 internal error
|
||||||
|
// @router /login [get]
|
||||||
|
func (o *OAuthController) GetLogin() {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
challenge := o.Ctx.Input.Query("login_challenge")
|
||||||
|
if challenge == "" {
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(400)
|
||||||
|
o.Data["json"] = map[string]string{"error": "missing login_challenge parameter"}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if conf.GetConfig().Local {
|
||||||
|
// In local mode, return a mock challenge for dev
|
||||||
|
o.Data["json"] = &auth_connectors.LoginChallenge{
|
||||||
|
Skip: false,
|
||||||
|
Challenge: challenge,
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
loginChallenge, err := infrastructure.GetAuthConnector().GetLoginChallenge(challenge)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to get login challenge: " + err.Error())
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(500)
|
||||||
|
o.Data["json"] = map[string]string{"error": err.Error()}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// If skip is true, the user already has an active session — auto-accept
|
||||||
|
if loginChallenge.Skip {
|
||||||
|
redirect, err := infrastructure.GetAuthConnector().AcceptLogin(challenge, loginChallenge.Subject)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to auto-accept login: " + err.Error())
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(500)
|
||||||
|
o.Data["json"] = map[string]string{"error": err.Error()}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
o.Data["json"] = redirect
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return challenge info so frontend can render login form
|
||||||
|
o.Data["json"] = loginChallenge
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title PostLogin
|
||||||
|
// @Description Authenticate user via LDAP and accept Hydra login challenge
|
||||||
|
// @Param body body auth_connectors.LoginRequest true "Login credentials and challenge"
|
||||||
|
// @Success 200 {object} auth_connectors.Redirect
|
||||||
|
// @Failure 401 invalid credentials
|
||||||
|
// @Failure 500 internal error
|
||||||
|
// @router /login [post]
|
||||||
|
func (o *OAuthController) Login() {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
var req auth_connectors.LoginRequest
|
||||||
|
if err := json.Unmarshal(o.Ctx.Input.CopyBody(10000000), &req); err != nil {
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(400)
|
||||||
|
o.Data["json"] = map[string]string{"error": "invalid request body"}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.Username == "" || req.Password == "" {
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(400)
|
||||||
|
o.Data["json"] = map[string]string{"error": "username and password are required"}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Authenticate via LDAP
|
||||||
|
ldap := auth_connectors.New()
|
||||||
|
found, err := ldap.Authenticate(o.Ctx.Request.Context(), req.Username, req.Password)
|
||||||
|
if err != nil || !found {
|
||||||
|
logger.Error().Msg("LDAP authentication failed for user: " + req.Username)
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(401)
|
||||||
|
o.Data["json"] = map[string]string{"error": "invalid credentials"}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if conf.GetConfig().Local {
|
||||||
|
// In local mode, return a mock token for dev
|
||||||
|
t := oclib.NewRequest(oclib.LibDataEnum(oclib.PEER), "", "", []string{}, nil).Search(
|
||||||
|
nil, fmt.Sprintf("%v", model.SELF.EnumIndex()), false)
|
||||||
|
if t.Err == "" && len(t.Data) > 0 {
|
||||||
|
p := t.Data[0].(*model.Peer)
|
||||||
|
c := infrastructure.GetClaims().BuildConsentSession("local", req.Username, p)
|
||||||
|
now := time.Now().UTC()
|
||||||
|
now = now.Add(3600 * time.Second)
|
||||||
|
c.Session.AccessToken["exp"] = now.Unix()
|
||||||
|
b, _ := json.Marshal(c)
|
||||||
|
token := &auth_connectors.Token{
|
||||||
|
Active: true,
|
||||||
|
TokenType: "Bearer",
|
||||||
|
ExpiresIn: 3600,
|
||||||
|
AccessToken: "localtoken." + base64.StdEncoding.EncodeToString(b),
|
||||||
|
}
|
||||||
|
o.Data["json"] = token
|
||||||
|
} else {
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(401)
|
||||||
|
o.Data["json"] = map[string]string{"error": "peer not found"}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.LoginChallenge == "" {
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(400)
|
||||||
|
o.Data["json"] = map[string]string{"error": "login_challenge is required in non-local mode"}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Accept the login challenge with Hydra
|
||||||
|
redirect, err := infrastructure.GetAuthConnector().AcceptLogin(req.LoginChallenge, req.Username)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to accept login: " + err.Error())
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(500)
|
||||||
|
o.Data["json"] = map[string]string{"error": err.Error()}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return redirect_to so the frontend follows the OAuth2 flow
|
||||||
|
o.Data["json"] = redirect
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Consent
|
||||||
|
// @Description Hydra redirects here with a consent_challenge. Auto-accepts consent with user permissions.
|
||||||
|
// @Param consent_challenge query string true "The consent challenge from Hydra"
|
||||||
|
// @Success 200 {object} auth_connectors.Redirect
|
||||||
|
// @Failure 400 missing consent_challenge
|
||||||
|
// @Failure 500 internal error
|
||||||
|
// @router /consent [get]
|
||||||
|
func (o *OAuthController) Consent() {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
challenge := o.Ctx.Input.Query("consent_challenge")
|
||||||
|
if challenge == "" {
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(400)
|
||||||
|
o.Data["json"] = map[string]string{"error": "missing consent_challenge parameter"}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get consent challenge details from Hydra
|
||||||
|
consentChallenge, err := infrastructure.GetAuthConnector().GetConsentChallenge(challenge)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to get consent challenge: " + err.Error())
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(500)
|
||||||
|
o.Data["json"] = map[string]string{"error": err.Error()}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get self peer for signing
|
||||||
|
pp := oclib.NewRequest(oclib.LibDataEnum(oclib.PEER), "", "", []string{}, nil).Search(
|
||||||
|
nil, strconv.Itoa(peer.SELF.EnumIndex()), false)
|
||||||
|
if len(pp.Data) == 0 || pp.Code >= 300 || pp.Err != "" {
|
||||||
|
logger.Error().Msg("Self peer not found")
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(500)
|
||||||
|
o.Data["json"] = map[string]string{"error": "self peer not found"}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
p := pp.Data[0].(*peer.Peer)
|
||||||
|
|
||||||
|
// Extract client_id from consent challenge
|
||||||
|
clientID := ""
|
||||||
|
if consentChallenge.Client != nil {
|
||||||
|
if cid, ok := consentChallenge.Client["client_id"].(string); ok {
|
||||||
|
clientID = cid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build consent session with user permissions and claims
|
||||||
|
session := infrastructure.GetClaims().BuildConsentSession(clientID, consentChallenge.Subject, p)
|
||||||
|
|
||||||
|
// Accept the consent challenge — grant all requested scopes
|
||||||
|
redirect, err := infrastructure.GetAuthConnector().AcceptConsent(challenge, consentChallenge.RequestedScope, session)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to accept consent: " + err.Error())
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(500)
|
||||||
|
o.Data["json"] = map[string]string{"error": err.Error()}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return redirect_to (callback URL with authorization code)
|
||||||
|
o.Data["json"] = redirect
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title GetLogout
|
||||||
|
// @Description Hydra redirects here with a logout_challenge. Accepts the challenge and returns a redirect URL.
|
||||||
|
// @Param logout_challenge query string true "The logout challenge from Hydra"
|
||||||
|
// @Success 200 {object} auth_connectors.Redirect
|
||||||
|
// @Failure 400 missing logout_challenge
|
||||||
|
// @Failure 500 internal error
|
||||||
|
// @router /logout [get]
|
||||||
|
func (o *OAuthController) GetLogout() {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
challenge := o.Ctx.Input.Query("logout_challenge")
|
||||||
|
if challenge == "" {
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(400)
|
||||||
|
o.Data["json"] = map[string]string{"error": "missing logout_challenge parameter"}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if conf.GetConfig().Local {
|
||||||
|
o.Data["json"] = &auth_connectors.Redirect{RedirectTo: ""}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := infrastructure.GetAuthConnector().GetLogoutChallenge(challenge)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to get logout challenge: " + err.Error())
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(500)
|
||||||
|
o.Data["json"] = map[string]string{"error": err.Error()}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
redirect, err := infrastructure.GetAuthConnector().AcceptLogout(challenge)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to accept logout challenge: " + err.Error())
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(500)
|
||||||
|
o.Data["json"] = map[string]string{"error": err.Error()}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
o.Data["json"] = redirect
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Logout
|
||||||
|
// @Description Revoke an OAuth2 token
|
||||||
|
// @Param Authorization header string false "Bearer token"
|
||||||
|
// @Param client_id query string true "The client_id"
|
||||||
|
// @Success 200 {object} auth_connectors.Token
|
||||||
|
// @router /logout [delete]
|
||||||
|
func (o *OAuthController) LogOut() {
|
||||||
|
clientID := o.Ctx.Input.Query("client_id")
|
||||||
|
reqToken := extractBearerToken(o.Ctx.Request)
|
||||||
|
|
||||||
|
if conf.GetConfig().Local {
|
||||||
|
o.Data["json"] = map[string]string{"status": "logged out"}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err := infrastructure.GetAuthConnector().RevokeToken(reqToken, clientID)
|
||||||
|
if err != nil {
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(500)
|
||||||
|
o.Data["json"] = map[string]string{"error": err.Error()}
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = &auth_connectors.Token{
|
||||||
|
AccessToken: reqToken,
|
||||||
|
Active: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Refresh
|
||||||
|
// @Description Exchange a refresh_token for a new token set
|
||||||
|
// @Param body body object true "refresh_token and client_id"
|
||||||
|
// @Success 200 {object} auth_connectors.TokenResponse
|
||||||
|
// @Failure 401 invalid refresh token
|
||||||
|
// @router /refresh [post]
|
||||||
|
func (o *OAuthController) Refresh() {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
var body struct {
|
||||||
|
RefreshToken string `json:"refresh_token"`
|
||||||
|
ClientID string `json:"client_id"`
|
||||||
|
}
|
||||||
|
json.Unmarshal(o.Ctx.Input.CopyBody(100000), &body)
|
||||||
|
|
||||||
|
if conf.GetConfig().Local {
|
||||||
|
o.Data["json"] = map[string]string{"error": "refresh not supported in local mode"}
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(400)
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if body.RefreshToken == "" {
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(400)
|
||||||
|
o.Data["json"] = map[string]string{"error": "refresh_token is required"}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
token, err := infrastructure.GetAuthConnector().RefreshToken(body.RefreshToken, body.ClientID)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to refresh token: " + err.Error())
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(401)
|
||||||
|
o.Data["json"] = map[string]string{"error": err.Error()}
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = token
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Introspect
|
||||||
|
// @Description Introspect a token — respects Hydra's response
|
||||||
|
// @Param Authorization header string false "Bearer token"
|
||||||
|
// @Success 200 {object} auth_connectors.IntrospectResult
|
||||||
|
// @router /introspect [get]
|
||||||
|
func (o *OAuthController) Introspect() {
|
||||||
|
reqToken := extractBearerToken(o.Ctx.Request)
|
||||||
|
if reqToken == "" {
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(401)
|
||||||
|
o.Data["json"] = map[string]string{"error": "missing bearer token"}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if conf.GetConfig().Local {
|
||||||
|
o.Data["json"] = &auth_connectors.IntrospectResult{Active: true}
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := infrastructure.GetAuthConnector().Introspect(reqToken)
|
||||||
|
if err != nil {
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(500)
|
||||||
|
o.Data["json"] = map[string]string{"error": err.Error()}
|
||||||
|
} else if !result.Active {
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(401)
|
||||||
|
o.Data["json"] = result
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = result
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
var whitelist = []string{
|
||||||
|
"/login",
|
||||||
|
"/refresh",
|
||||||
|
"/introspect",
|
||||||
|
"/consent",
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title AuthForward
|
||||||
|
// @Description Forward auth for Traefik — validates JWT via Hydra introspection
|
||||||
|
// @Param Authorization header string false "Bearer token"
|
||||||
|
// @Success 200 {string}
|
||||||
|
// @router /forward [get]
|
||||||
|
func (o *OAuthController) InternalAuthForward() {
|
||||||
|
reqToken := o.Ctx.Request.Header.Get("Authorization")
|
||||||
|
if reqToken == "" {
|
||||||
|
for _, w := range whitelist {
|
||||||
|
if strings.Contains(o.Ctx.Request.Header.Get("X-Forwarded-Uri"), w) {
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(200)
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(401)
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
splitToken := strings.Split(reqToken, "Bearer ")
|
||||||
|
if len(splitToken) < 2 {
|
||||||
|
reqToken = ""
|
||||||
|
} else {
|
||||||
|
reqToken = splitToken[1]
|
||||||
|
}
|
||||||
|
origin, publicKey, external := o.extractOrigin(o.Ctx.Request)
|
||||||
|
if !infrastructure.GetAuthConnector().CheckAuthForward(
|
||||||
|
reqToken, publicKey, origin,
|
||||||
|
o.Ctx.Request.Header.Get("X-Forwarded-Method"),
|
||||||
|
o.Ctx.Request.Header.Get("X-Forwarded-Uri"), external) && origin != "" && publicKey != "" {
|
||||||
|
o.Ctx.ResponseWriter.WriteHeader(401)
|
||||||
|
o.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *OAuthController) extractOrigin(request *http.Request) (string, string, bool) {
|
||||||
|
user, peerID, groups := oclib.ExtractTokenInfo(*request)
|
||||||
|
external := true
|
||||||
|
publicKey := ""
|
||||||
|
origin := o.Ctx.Request.Header.Get("X-Forwarded-Host")
|
||||||
|
if origin == "" {
|
||||||
|
origin = o.Ctx.Request.Header.Get("Origin")
|
||||||
|
}
|
||||||
|
searchStr := origin
|
||||||
|
r := regexp.MustCompile("(:[0-9]+)")
|
||||||
|
t := r.FindString(searchStr)
|
||||||
|
if t != "" {
|
||||||
|
searchStr = strings.Replace(searchStr, t, "", -1)
|
||||||
|
}
|
||||||
|
pp := oclib.NewRequest(oclib.LibDataEnum(oclib.PEER), user, peerID, groups, nil).Search(nil, searchStr, false)
|
||||||
|
if pp.Code != 200 || len(pp.Data) == 0 {
|
||||||
|
return "", "", external
|
||||||
|
}
|
||||||
|
p := pp.Data[0].(*model.Peer)
|
||||||
|
publicKey = p.PublicKey
|
||||||
|
origin = p.APIUrl
|
||||||
|
if origin != "" {
|
||||||
|
if p.Relation == peer.SELF {
|
||||||
|
external = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
external = false
|
||||||
|
}
|
||||||
|
return origin, publicKey, external
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExtractClient extracts the client_id from a JWT token.
|
||||||
|
// Supports both standard JWT (3 parts with base64 payload) and local dev tokens.
|
||||||
|
func ExtractClient(request http.Request) string {
|
||||||
|
reqToken := request.Header.Get("Authorization")
|
||||||
|
splitToken := strings.Split(reqToken, "Bearer ")
|
||||||
|
if len(splitToken) < 2 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
reqToken = splitToken[1]
|
||||||
|
if reqToken == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to decode as standard JWT (header.payload.signature)
|
||||||
|
parts := strings.Split(reqToken, ".")
|
||||||
|
if len(parts) >= 2 {
|
||||||
|
// Decode the payload (second part of JWT)
|
||||||
|
payload := parts[1]
|
||||||
|
// Add padding if needed
|
||||||
|
switch len(payload) % 4 {
|
||||||
|
case 2:
|
||||||
|
payload += "=="
|
||||||
|
case 3:
|
||||||
|
payload += "="
|
||||||
|
}
|
||||||
|
bytes, err := base64.URLEncoding.DecodeString(payload)
|
||||||
|
if err != nil {
|
||||||
|
// Try standard base64 for local dev tokens
|
||||||
|
bytes, err = base64.StdEncoding.DecodeString(parts[len(parts)-1])
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m := map[string]interface{}{}
|
||||||
|
if err := json.Unmarshal(bytes, &m); err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
// Standard JWT: look for client_id in top-level or ext claims
|
||||||
|
if cid, ok := m["client_id"].(string); ok {
|
||||||
|
return cid
|
||||||
|
}
|
||||||
|
if ext, ok := m["ext"].(map[string]interface{}); ok {
|
||||||
|
if cid, ok := ext["client_id"].(string); ok {
|
||||||
|
return cid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Local dev token format: session.id_token.client_id
|
||||||
|
if session, ok := m["session"].(map[string]interface{}); ok {
|
||||||
|
if idToken, ok := session["id_token"].(map[string]interface{}); ok {
|
||||||
|
if cid, ok := idToken["client_id"].(string); ok {
|
||||||
|
return cid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// extractBearerToken extracts the token from the Authorization header
|
||||||
|
func extractBearerToken(r *http.Request) string {
|
||||||
|
reqToken := r.Header.Get("Authorization")
|
||||||
|
splitToken := strings.Split(reqToken, "Bearer ")
|
||||||
|
if len(splitToken) < 2 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return splitToken[1]
|
||||||
|
}
|
||||||
199
controllers/permission.go
Normal file
199
controllers/permission.go
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
package controllers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"oc-auth/infrastructure"
|
||||||
|
|
||||||
|
beego "github.com/beego/beego/v2/server/web"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Operations about auth
|
||||||
|
type PermissionController struct {
|
||||||
|
beego.Controller
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title GetAll
|
||||||
|
// @Description find permissions
|
||||||
|
// @Success 200 {permission} string
|
||||||
|
// @router / [get]
|
||||||
|
func (o *PermissionController) GetAll() {
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, err := infrastructure.GetPermissionConnector(clientID).GetPermission("", "")
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title GetByRole
|
||||||
|
// @Description find permission by role id
|
||||||
|
// @Param id path string true "the id you want to get"
|
||||||
|
// @Success 200 {auth} string
|
||||||
|
// @router /role/:id [get]
|
||||||
|
func (o *PermissionController) GetByRole() {
|
||||||
|
id := o.Ctx.Input.Param(":id")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, err := infrastructure.GetPermissionConnector(clientID).GetPermissionByRole(id)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title GetByUser
|
||||||
|
// @Description find permission by user id
|
||||||
|
// @Param id path string true "the id you want to get"
|
||||||
|
// @Success 200 {auth} string
|
||||||
|
// @router /user/:id [get]
|
||||||
|
func (o *PermissionController) GetByUser() {
|
||||||
|
id := o.Ctx.Input.Param(":id")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, err := infrastructure.GetPermissionConnector(clientID).GetPermissionByUser(id, true)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Get
|
||||||
|
// @Description find auth by permission
|
||||||
|
// @Param id path string true "the permission you want to get"
|
||||||
|
// @Success 200 {auth} models.auth
|
||||||
|
// @router /:id/:relation [get]
|
||||||
|
func (o *PermissionController) Get() {
|
||||||
|
id := o.Ctx.Input.Param(":id")
|
||||||
|
rel := o.Ctx.Input.Param(":relation")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, err := infrastructure.GetPermissionConnector(clientID).GetPermission(id, rel)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Clear
|
||||||
|
// @Description clear the permission
|
||||||
|
// @Success 200 {string} delete success!
|
||||||
|
// @router /clear [delete]
|
||||||
|
func (o *PermissionController) Clear() {
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, code, err := infrastructure.GetPermissionConnector(clientID).DeletePermission("", "", true)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": code,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Bind
|
||||||
|
// @Description bind the permission to role
|
||||||
|
// @Param role_id path string true "The role_id you want to bind"
|
||||||
|
// @Param method path string true "The method you want to relate role & permission"
|
||||||
|
// @Param permission_id path string true "The permission_id you want to bind"
|
||||||
|
// @Success 200 {string} bind success!
|
||||||
|
// @router /:permission_id/:role_id/:relation [post]
|
||||||
|
func (o *PermissionController) Bind() {
|
||||||
|
permission_id := o.Ctx.Input.Param(":permission_id")
|
||||||
|
role_id := o.Ctx.Input.Param(":role_id")
|
||||||
|
rel := o.Ctx.Input.Param(":relation")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, code, err := infrastructure.GetPermissionConnector(clientID).BindPermission(role_id, permission_id, rel)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": code,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title UnBind
|
||||||
|
// @Description unbind the permission to role
|
||||||
|
// @Param role_id path string true "The role_id you want to unbind"
|
||||||
|
// @Param relation path string true "The method you want to unrelate role & permission"
|
||||||
|
// @Param permission_id path string true "The permission_id you want to unbind"
|
||||||
|
// @Success 200 {string} bind success!
|
||||||
|
// @router /:permission_id/:role_id/:relation [delete]
|
||||||
|
func (o *PermissionController) UnBind() {
|
||||||
|
permission_id := o.Ctx.Input.Param(":permission_id")
|
||||||
|
role_id := o.Ctx.Input.Param(":role_id")
|
||||||
|
rel := o.Ctx.Input.Param(":relation")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, code, err := infrastructure.GetPermissionConnector(clientID).UnBindPermission(role_id, permission_id, rel)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": code,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
package controllers
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"log"
|
|
||||||
"oc-auth/models"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
beego "github.com/beego/beego/v2/server/web"
|
|
||||||
"github.com/nats-io/nats.go"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Operations about auth
|
|
||||||
type RegistrationController struct {
|
|
||||||
beego.Controller
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Title Create
|
|
||||||
// @Description create auths
|
|
||||||
// @Param body body models.Application true "The app info"
|
|
||||||
// @Success 200 {string} models.auth.Id
|
|
||||||
// @Failure 403 body is empty
|
|
||||||
// @router / [post]
|
|
||||||
func (o *RegistrationController) Post() {
|
|
||||||
var app models.Application
|
|
||||||
// Store the app info in the nats server
|
|
||||||
err := json.Unmarshal(o.Ctx.Input.RequestBody, &app)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
servers := []string{"nats://127.0.0.1:1222", "nats://127.0.0.1:1223", "nats://127.0.0.1:1224"}
|
|
||||||
|
|
||||||
nc, err := nats.Connect(strings.Join(servers, ","))
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
defer nc.Close()
|
|
||||||
js, err := nc.JetStream(nats.PublishAsyncMaxPending(256))
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
kv, err := js.KeyValue("auth")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
kv.Put(app.ClientId, o.Ctx.Input.RequestBody)
|
|
||||||
// register to OIDC server
|
|
||||||
|
|
||||||
// store and return Id or post with UUID
|
|
||||||
o.Data["json"] = map[string]string{"Id": "?"}
|
|
||||||
o.ServeJSON()
|
|
||||||
}
|
|
||||||
221
controllers/role.go
Normal file
221
controllers/role.go
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
package controllers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"oc-auth/infrastructure"
|
||||||
|
|
||||||
|
beego "github.com/beego/beego/v2/server/web"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Operations about auth
|
||||||
|
type RoleController struct {
|
||||||
|
beego.Controller
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Create
|
||||||
|
// @Description create role
|
||||||
|
// @Param id path string true "the id you want to get"
|
||||||
|
// @Success 200 {auth} create success!
|
||||||
|
// @router /:id [post]
|
||||||
|
func (o *RoleController) Post() {
|
||||||
|
// store and return Id or post with UUID
|
||||||
|
id := o.Ctx.Input.Param(":id")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, code, err := infrastructure.GetPermissionConnector(clientID).CreateRole(id)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": code,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title GetByUser
|
||||||
|
// @Description find role by user id
|
||||||
|
// @Param id path string true "the id you want to get"
|
||||||
|
// @Success 200 {auth} string
|
||||||
|
// @router /user/:id [get]
|
||||||
|
func (o *RoleController) GetByUser() {
|
||||||
|
id := o.Ctx.Input.Param(":id")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, err := infrastructure.GetPermissionConnector(clientID).GetRoleByUser(id)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title GetAll
|
||||||
|
// @Description find roles
|
||||||
|
// @Success 200 {role} string
|
||||||
|
// @router / [get]
|
||||||
|
func (o *RoleController) GetAll() {
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, err := infrastructure.GetPermissionConnector(clientID).GetRole("")
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Get
|
||||||
|
// @Description find role by id
|
||||||
|
// @Param id path string true "the id you want to get"
|
||||||
|
// @Success 200 {role} string
|
||||||
|
// @router /:id [get]
|
||||||
|
func (o *RoleController) Get() {
|
||||||
|
id := o.Ctx.Input.Param(":id")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, err := infrastructure.GetPermissionConnector(clientID).GetRole(id)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Delete
|
||||||
|
// @Description delete the role
|
||||||
|
// @Param id path string true "The id you want to delete"
|
||||||
|
// @Success 200 {string} delete success!
|
||||||
|
// @router /:id [delete]
|
||||||
|
func (o *RoleController) Delete() {
|
||||||
|
id := o.Ctx.Input.Param(":id")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, code, err := infrastructure.GetPermissionConnector(clientID).DeleteRole(id)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": code,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Clear
|
||||||
|
// @Description clear the role
|
||||||
|
// @Success 200 {string} delete success!
|
||||||
|
// @router /clear [delete]
|
||||||
|
func (o *RoleController) Clear() {
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, code, err := infrastructure.GetPermissionConnector(clientID).DeleteRole("")
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": code,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Bind
|
||||||
|
// @Description bind the role to user
|
||||||
|
// @Param user_id path string true "The user_id you want to bind"
|
||||||
|
// @Param role_id path string true "The role_id you want to bind"
|
||||||
|
// @Success 200 {string} bind success!
|
||||||
|
// @router /:user_id/:role_id [post]
|
||||||
|
func (o *RoleController) Bind() {
|
||||||
|
user_id := o.Ctx.Input.Param(":user_id")
|
||||||
|
role_id := o.Ctx.Input.Param(":role_id")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, code, err := infrastructure.GetPermissionConnector(clientID).BindRole(user_id, role_id)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": code,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title UnBind
|
||||||
|
// @Description unbind the role to user
|
||||||
|
// @Param role_id path string true "The role_id you want to unbind"
|
||||||
|
// @Param user_id path string true "The user_id you want to unbind"
|
||||||
|
// @Success 200 {string} bind success!
|
||||||
|
// @router /:user_id/:role_id [delete]
|
||||||
|
func (o *RoleController) UnBind() {
|
||||||
|
user_id := o.Ctx.Input.Param(":user_id")
|
||||||
|
role_id := o.Ctx.Input.Param(":role_id")
|
||||||
|
clientID := ExtractClient(*o.Ctx.Request)
|
||||||
|
role, code, err := infrastructure.GetPermissionConnector(clientID).UnBindRole(user_id, role_id)
|
||||||
|
if err != nil {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": nil,
|
||||||
|
"error": err.Error(),
|
||||||
|
"code": code,
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
o.Data["json"] = map[string]interface{}{
|
||||||
|
"data": role,
|
||||||
|
"error": nil,
|
||||||
|
"code": 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.ServeJSON()
|
||||||
|
}
|
||||||
@@ -14,6 +14,21 @@ type VersionController struct {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @router / [get]
|
// @router / [get]
|
||||||
func (c *VersionController) GetAll() {
|
func (c *VersionController) GetAll() {
|
||||||
c.Data["json"] = map[string]string{"version": "1"}
|
c.Data["json"] = map[string]string{
|
||||||
|
"service": "oc-auth",
|
||||||
|
"version": "1",
|
||||||
|
}
|
||||||
|
c.ServeJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title Get
|
||||||
|
// @Description get version
|
||||||
|
// @Success 200
|
||||||
|
// @router /discovery [get]
|
||||||
|
func (c *VersionController) Get() {
|
||||||
|
c.Data["json"] = map[string]string{
|
||||||
|
"service": "oc-auth",
|
||||||
|
"version": "1",
|
||||||
|
}
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,32 @@
|
|||||||
version: '3.4'
|
version: '3.4'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
ocauth:
|
oc-auth:
|
||||||
image: 'ocauth:latest'
|
image: 'oc-auth:latest'
|
||||||
ports:
|
ports:
|
||||||
- 8088:8080
|
- 8094:8080
|
||||||
container_name: ocauth
|
container_name: oc-auth
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.auth.entrypoints=web"
|
||||||
|
- "traefik.http.routers.auth.rule=PathPrefix(`/auth`)"
|
||||||
|
- "traefik.http.middlewares.auth-rewrite.replacepathregex.regex=^/auth(.*)"
|
||||||
|
- "traefik.http.middlewares.auth-rewrite.replacepathregex.replacement=/oc$$1"
|
||||||
|
- "traefik.http.routers.auth.middlewares=auth-rewrite"
|
||||||
|
- "traefik.http.services.auth.loadbalancer.server.port=8080"
|
||||||
|
- "traefik.http.middlewares.auth.forwardauth.address=http://oc-auth:8080/oc/forward"
|
||||||
|
environment:
|
||||||
|
LDAP_ENDPOINTS: ldap:389
|
||||||
|
LDAP_BINDDN: cn=admin,dc=example,dc=com
|
||||||
|
LDAP_BINDPW: password
|
||||||
|
LDAP_BASEDN: "dc=example,dc=com"
|
||||||
|
LDAP_USER_BASEDN: "ou=users,dc=example,dc=com"
|
||||||
|
LDAP_ROLE_BASEDN: "ou=AppRoles,dc=example,dc=com"
|
||||||
|
networks:
|
||||||
|
- oc
|
||||||
|
volumes:
|
||||||
|
- ./pem/private.pem:/keys/private/private.pem
|
||||||
|
- ./pem/public.pem:/keys/public/public.pem
|
||||||
|
networks:
|
||||||
|
oc:
|
||||||
|
external: true
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
{
|
{
|
||||||
"natsurl":"http://localhost:4080",
|
"MONGO_URL":"mongodb://mongo:27017/",
|
||||||
"login":"admin",
|
"MONGO_DATABASE":"DC_myDC",
|
||||||
"password":"admin",
|
"NATS_URL": "nats://nats:4222",
|
||||||
"oidcserver":"http://localhost:8080"
|
"AUTH_CONNECTOR_HOST": "hydra",
|
||||||
|
"AUTH_CONNECTOR_PUBLIC_HOST": "hydra",
|
||||||
|
"PRIVATE_KEY_PATH": "/keys/private/private.pem",
|
||||||
|
"PUBLIC_KEY_PATH": "/keys/public/public.pem",
|
||||||
|
"LDAP_ENDPOINTS": "ldap:389",
|
||||||
|
"LOCAL": false
|
||||||
}
|
}
|
||||||
4
env.env
Normal file
4
env.env
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
KUBERNETES_SERVICE_HOST=192.168.47.20
|
||||||
|
KUBE_CA="LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJkekNDQVIyZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQWpNU0V3SHdZRFZRUUREQmhyTTNNdGMyVnkKZG1WeUxXTmhRREUzTWpNeE1USXdNell3SGhjTk1qUXdPREE0TVRBeE16VTJXaGNOTXpRd09EQTJNVEF4TXpVMgpXakFqTVNFd0h3WURWUVFEREJock0zTXRjMlZ5ZG1WeUxXTmhRREUzTWpNeE1USXdNell3V1RBVEJnY3Foa2pPClBRSUJCZ2dxaGtqT1BRTUJCd05DQUFTVlk3ZHZhNEdYTVdkMy9jMlhLN3JLYjlnWXgyNSthaEE0NmkyNVBkSFAKRktQL2UxSVMyWVF0dzNYZW1TTUQxaStZdzJSaVppNUQrSVZUamNtNHdhcnFvMEl3UURBT0JnTlZIUThCQWY4RQpCQU1DQXFRd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVWtlUVJpNFJiODduME5yRnZaWjZHClc2SU55NnN3Q2dZSUtvWkl6ajBFQXdJRFNBQXdSUUlnRXA5ck04WmdNclRZSHYxZjNzOW5DZXZZeWVVa3lZUk4KWjUzazdoaytJS1FDSVFDbk05TnVGKzlTakIzNDFacGZ5ays2NEpWdkpSM3BhcmVaejdMd2lhNm9kdz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K"
|
||||||
|
KUBE_CERT="LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJrVENDQVRlZ0F3SUJBZ0lJWUxWNkFPQkdrU1F3Q2dZSUtvWkl6ajBFQXdJd0l6RWhNQjhHQTFVRUF3d1kKYXpOekxXTnNhV1Z1ZEMxallVQXhOekl6TVRFeU1ETTJNQjRYRFRJME1EZ3dPREV3TVRNMU5sb1hEVEkxTURndwpPREV3TVRNMU5sb3dNREVYTUJVR0ExVUVDaE1PYzNsemRHVnRPbTFoYzNSbGNuTXhGVEFUQmdOVkJBTVRESE41CmMzUmxiVHBoWkcxcGJqQlpNQk1HQnlxR1NNNDlBZ0VHQ0NxR1NNNDlBd0VIQTBJQUJGQ2Q1MFdPeWdlQ2syQzcKV2FrOWY4MVAvSkJieVRIajRWOXBsTEo0ck5HeHFtSjJOb2xROFYxdUx5RjBtOTQ2Nkc0RmRDQ2dqaXFVSk92Swp3NVRPNnd5alNEQkdNQTRHQTFVZER3RUIvd1FFQXdJRm9EQVRCZ05WSFNVRUREQUtCZ2dyQmdFRkJRY0RBakFmCkJnTlZIU01FR0RBV2dCVFJkOFI5cXVWK2pjeUVmL0ovT1hQSzMyS09XekFLQmdncWhrak9QUVFEQWdOSUFEQkYKQWlFQTArbThqTDBJVldvUTZ0dnB4cFo4NVlMalF1SmpwdXM0aDdnSXRxS3NmUVVDSUI2M2ZNdzFBMm5OVWU1TgpIUGZOcEQwSEtwcVN0Wnk4djIyVzliYlJUNklZCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0KLS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJlRENDQVIyZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQWpNU0V3SHdZRFZRUUREQmhyTTNNdFkyeHAKWlc1MExXTmhRREUzTWpNeE1USXdNell3SGhjTk1qUXdPREE0TVRBeE16VTJXaGNOTXpRd09EQTJNVEF4TXpVMgpXakFqTVNFd0h3WURWUVFEREJock0zTXRZMnhwWlc1MExXTmhRREUzTWpNeE1USXdNell3V1RBVEJnY3Foa2pPClBRSUJCZ2dxaGtqT1BRTUJCd05DQUFRc3hXWk9pbnIrcVp4TmFEQjVGMGsvTDF5cE01VHAxOFRaeU92ektJazQKRTFsZWVqUm9STW0zNmhPeVljbnN3d3JoNnhSUnBpMW5RdGhyMzg0S0Z6MlBvMEl3UURBT0JnTlZIUThCQWY4RQpCQU1DQXFRd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVTBYZkVmYXJsZm8zTWhIL3lmemx6Cnl0OWlqbHN3Q2dZSUtvWkl6ajBFQXdJRFNRQXdSZ0loQUxJL2dNYnNMT3MvUUpJa3U2WHVpRVMwTEE2cEJHMXgKcnBlTnpGdlZOekZsQWlFQW1wdjBubjZqN3M0MVI0QzFNMEpSL0djNE53MHdldlFmZWdEVGF1R2p3cFk9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K"
|
||||||
|
KUBE_DATA="LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSU5ZS1BFb1dhd1NKUzJlRW5oWmlYMk5VZlY1ZlhKV2krSVNnV09TNFE5VTlvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFVUozblJZN0tCNEtUWUx0WnFUMS96VS84a0Z2Sk1lUGhYMm1Vc25pczBiR3FZblkyaVZEeApYVzR2SVhTYjNqcm9iZ1YwSUtDT0twUWs2OHJEbE03ckRBPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo="
|
||||||
79
go.mod
79
go.mod
@@ -1,41 +1,72 @@
|
|||||||
module oc-auth
|
module oc-auth
|
||||||
|
|
||||||
go 1.19
|
go 1.24.6
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/beego/beego v1.12.11
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260219084344-9662ac6d678c
|
||||||
github.com/beego/beego/v2 v2.0.7
|
github.com/beego/beego/v2 v2.3.1
|
||||||
github.com/goraz/onion v0.1.3
|
|
||||||
github.com/nats-io/nats.go v1.36.0
|
|
||||||
github.com/smartystreets/goconvey v1.7.2
|
github.com/smartystreets/goconvey v1.7.2
|
||||||
|
go.uber.org/zap v1.27.0
|
||||||
|
)
|
||||||
|
|
||||||
|
//replace cloud.o-forge.io/core/oc-lib => ../oc-lib
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
|
||||||
|
github.com/biter777/countries v1.7.5 // indirect
|
||||||
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
|
||||||
|
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
|
||||||
|
github.com/gofrs/uuid v4.3.0+incompatible // indirect
|
||||||
|
github.com/libp2p/go-libp2p/core v0.43.0-rc2 // indirect
|
||||||
|
github.com/nats-io/nats.go v1.37.0 // indirect
|
||||||
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||||
|
github.com/rogpeppe/go-internal v1.13.1 // indirect
|
||||||
|
go.uber.org/multierr v1.10.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/coocood/freecache v1.2.4
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.6 // indirect
|
||||||
|
github.com/go-ldap/ldap/v3 v3.4.8
|
||||||
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
|
github.com/go-playground/validator/v10 v10.22.1 // indirect
|
||||||
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
|
||||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
github.com/goraz/onion v0.1.3 // indirect
|
||||||
|
github.com/hashicorp/golang-lru v1.0.2 // indirect
|
||||||
|
github.com/i-core/rlog v1.0.0
|
||||||
github.com/jtolds/gls v4.20.0+incompatible // indirect
|
github.com/jtolds/gls v4.20.0+incompatible // indirect
|
||||||
github.com/klauspost/compress v1.17.2 // indirect
|
github.com/klauspost/compress v1.17.11 // indirect
|
||||||
github.com/kr/pretty v0.3.1 // indirect
|
github.com/leodido/go-urn v1.4.0 // indirect
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
|
github.com/montanaflynn/stats v0.7.1 // indirect
|
||||||
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
github.com/nats-io/nkeys v0.4.7 // indirect
|
github.com/nats-io/nkeys v0.4.7 // indirect
|
||||||
github.com/nats-io/nuid v1.0.1 // indirect
|
github.com/nats-io/nuid v1.0.1 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/prometheus/client_golang v1.20.5 // indirect
|
||||||
github.com/prometheus/client_golang v1.14.0 // indirect
|
github.com/prometheus/client_model v0.6.1 // indirect
|
||||||
github.com/prometheus/client_model v0.3.0 // indirect
|
github.com/prometheus/common v0.60.1 // indirect
|
||||||
github.com/prometheus/common v0.41.0 // indirect
|
github.com/prometheus/procfs v0.15.1 // indirect
|
||||||
github.com/prometheus/procfs v0.9.0 // indirect
|
github.com/rs/zerolog v1.33.0 // indirect
|
||||||
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
|
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 // indirect
|
||||||
github.com/smartystreets/assertions v1.2.0 // indirect
|
github.com/smartystreets/assertions v1.2.0 // indirect
|
||||||
github.com/stretchr/testify v1.8.1 // indirect
|
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||||
golang.org/x/crypto v0.18.0 // indirect
|
github.com/xdg-go/scram v1.1.2 // indirect
|
||||||
golang.org/x/net v0.10.0 // indirect
|
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||||
golang.org/x/sys v0.16.0 // indirect
|
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
|
||||||
golang.org/x/text v0.14.0 // indirect
|
go.mongodb.org/mongo-driver v1.17.1 // indirect
|
||||||
google.golang.org/protobuf v1.28.1 // indirect
|
golang.org/x/crypto v0.39.0 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
golang.org/x/net v0.30.0 // indirect
|
||||||
|
golang.org/x/sync v0.15.0 // indirect
|
||||||
|
golang.org/x/sys v0.33.0 // indirect
|
||||||
|
golang.org/x/text v0.26.0 // indirect
|
||||||
|
google.golang.org/protobuf v1.36.6 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
372
go.sum
372
go.sum
@@ -1,105 +1,113 @@
|
|||||||
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260204083845-d9f646aac28b h1:/TkmuO5ERpHJCqNpKBlmzw8pYTVDGcFcDo+e1ndXlm0=
|
||||||
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260204083845-d9f646aac28b/go.mod h1:T0UCxRd8w+qCVVC0NEyDiWIGC5ADwEbQ7hFcvftd4Ks=
|
||||||
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260210081202-3bcf0da56aa1 h1:CSPqJlSepu0efDRFV8tv62Fg5XP2UwSZKfaaL81YuVY=
|
||||||
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260210081202-3bcf0da56aa1/go.mod h1:jmyBwmsac/4V7XPL347qawF60JsBCDmNAMfn/ySXKYo=
|
||||||
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260212123952-403913d8cf13 h1:DNIPQ7C+7wjbj5RUx29wLxuIe/wiSOcuUMlLRIv6Fvs=
|
||||||
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260212123952-403913d8cf13/go.mod h1:jmyBwmsac/4V7XPL347qawF60JsBCDmNAMfn/ySXKYo=
|
||||||
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260219084344-9662ac6d678c h1:brsB6se+xMv386Vf6dSu3In2QZSH4EqgcAYkI4fNpJw=
|
||||||
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260219084344-9662ac6d678c/go.mod h1:jmyBwmsac/4V7XPL347qawF60JsBCDmNAMfn/ySXKYo=
|
||||||
|
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8=
|
||||||
|
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
|
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa h1:LHTHcTQiSGT7VVbI0o4wBRNQIgn917usHWOd6VAffYI=
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
|
||||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
github.com/beego/beego/v2 v2.3.1 h1:7MUKMpJYzOXtCUsTEoXOxsDV/UcHw6CPbaWMlthVNsc=
|
||||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
github.com/beego/beego/v2 v2.3.1/go.mod h1:5cqHsOHJIxkq44tBpRvtDe59GuVRVv/9/tyVDxd5ce4=
|
||||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
|
||||||
github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
|
|
||||||
github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk=
|
|
||||||
github.com/beego/beego v1.12.11 h1:MWKcnpavb7iAIS0m6uuEq6pHKkYvGNw/5umIUKqL7jM=
|
|
||||||
github.com/beego/beego v1.12.11/go.mod h1:QURFL1HldOcCZAxnc1cZ7wrplsYR5dKPHFjmk6WkLAs=
|
|
||||||
github.com/beego/beego/v2 v2.0.7 h1:9KNnUM40tn3pbCOFfe6SJ1oOL0oTi/oBS/C/wCEdAXA=
|
|
||||||
github.com/beego/beego/v2 v2.0.7/go.mod h1:f0uOEkmJWgAuDTlTxUdgJzwG3PDSIf3UWF3NpMohbFE=
|
|
||||||
github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ=
|
|
||||||
github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU=
|
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
|
||||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
|
||||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
|
github.com/biter777/countries v1.7.5 h1:MJ+n3+rSxWQdqVJU8eBy9RqcdH6ePPn4PJHocVWUa+Q=
|
||||||
github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE=
|
github.com/biter777/countries v1.7.5/go.mod h1:1HSpZ526mYqKJcpT5Ti1kcGQ0L0SrXWIaptUWjFfv2E=
|
||||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
|
github.com/coocood/freecache v1.2.4 h1:UdR6Yz/X1HW4fZOuH0Z94KwG851GWOSknua5VUbb/5M=
|
||||||
|
github.com/coocood/freecache v1.2.4/go.mod h1:RBUWa/Cy+OHdfTGFEhEuE1pMCMX51Ncizj7rthiQ3vk=
|
||||||
github.com/coreos/etcd v3.3.17+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
github.com/coreos/etcd v3.3.17+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||||
github.com/couchbase/go-couchbase v0.0.0-20201216133707-c04035124b17/go.mod h1:+/bddYDxXsf9qt0xpDUtRR47A2GjaXmGGAqQ/k3GJ8A=
|
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
github.com/couchbase/gomemcached v0.1.2-0.20201224031647-c432ccf49f32/go.mod h1:mxliKQxOv84gQ0bJWbI+w9Wxdpt9HjDvgW9MjCym5Vo=
|
|
||||||
github.com/couchbase/goutils v0.0.0-20210118111533-e33d3ffb5401/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
|
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
|
||||||
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||||
github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI=
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc=
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40=
|
||||||
github.com/elazarl/go-bindata-assetfs v1.0.1 h1:m0kkaHRKEu7tUIUFVwhGGGYClXvyl4RE03qmvRTNfbw=
|
github.com/elazarl/go-bindata-assetfs v1.0.1 h1:m0kkaHRKEu7tUIUFVwhGGGYClXvyl4RE03qmvRTNfbw=
|
||||||
|
github.com/elazarl/go-bindata-assetfs v1.0.1/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
|
||||||
github.com/etcd-io/etcd v3.3.17+incompatible/go.mod h1:cdZ77EstHBwVtD6iTgzgvogwcjo9m4iOqoijouPJ4bs=
|
github.com/etcd-io/etcd v3.3.17+incompatible/go.mod h1:cdZ77EstHBwVtD6iTgzgvogwcjo9m4iOqoijouPJ4bs=
|
||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw=
|
github.com/gabriel-vasile/mimetype v1.4.6 h1:3+PzJTKLkvgjeTbts6msPJt4DixhT4YtFNf1gtGe3zc=
|
||||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
github.com/gabriel-vasile/mimetype v1.4.6/go.mod h1:JX1qVKqZd40hUPpAfiNTe0Sne7hdfKSbOqqmkq8GCXc=
|
||||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
github.com/go-asn1-ber/asn1-ber v1.5.5 h1:MNHlNMBDgEKD4TcKr36vQN68BA00aDfjIt3/bD50WnA=
|
||||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
github.com/go-asn1-ber/asn1-ber v1.5.5/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
|
||||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
github.com/go-ldap/ldap/v3 v3.4.8 h1:loKJyspcRezt2Q3ZRMq2p/0v8iOurlmeXDPw6fikSvQ=
|
||||||
github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
github.com/go-ldap/ldap/v3 v3.4.8/go.mod h1:qS3Sjlu76eHfHGpUdWkAXQTw4beih+cHsco2jXlIXrk=
|
||||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
github.com/go-playground/validator/v10 v10.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27HYW8P9FDk5PbgA=
|
||||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc=
|
||||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
github.com/gofrs/uuid v4.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
|
||||||
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
|
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
github.com/goraz/onion v0.1.3 h1:KhyvbDA2b70gcz/d5izfwTiOH8SmrvV43AsVzpng3n0=
|
github.com/goraz/onion v0.1.3 h1:KhyvbDA2b70gcz/d5izfwTiOH8SmrvV43AsVzpng3n0=
|
||||||
github.com/goraz/onion v0.1.3/go.mod h1:XEmz1XoBz+wxTgWB8NwuvRm4RAu3vKxvrmYtzK+XCuQ=
|
github.com/goraz/onion v0.1.3/go.mod h1:XEmz1XoBz+wxTgWB8NwuvRm4RAu3vKxvrmYtzK+XCuQ=
|
||||||
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
|
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
|
||||||
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
|
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
|
||||||
|
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
|
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
|
||||||
|
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||||
|
github.com/i-core/rlog v1.0.0 h1:8CY2rsqvm3Z9cfl3hroppn8LTBwbtL45+ho79JTz8Jg=
|
||||||
|
github.com/i-core/rlog v1.0.0/go.mod h1:wTQKCF9IKx2HlNQ2M7dUpP3zIOD5ayqF4X3uQFbwY3g=
|
||||||
github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8=
|
||||||
|
github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs=
|
||||||
|
github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo=
|
||||||
|
github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM=
|
||||||
|
github.com/jcmturner/gofork v1.7.6 h1:QH0l3hzAU1tfT3rZCnW5zXl+orbkNMMRGJfdJjHVETg=
|
||||||
|
github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nDd82IeqRo=
|
||||||
|
github.com/jcmturner/goidentity/v6 v6.0.1 h1:VKnZd2oEIMorCTsFBnJWbExfNN7yZr3EhJAxwOkZg6o=
|
||||||
|
github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg=
|
||||||
|
github.com/jcmturner/gokrb5/v8 v8.4.4 h1:x1Sv4HaTpepFkXbt2IkL29DXRf8sOfZXo8eRKh687T8=
|
||||||
|
github.com/jcmturner/gokrb5/v8 v8.4.4/go.mod h1:1btQEpgT6k+unzCwX1KdWMEwPPkkgBtP+F6aCACiMrs=
|
||||||
|
github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZY=
|
||||||
|
github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc=
|
||||||
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
|
||||||
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||||
github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4=
|
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||||
github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
|
||||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ=
|
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||||
|
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||||
|
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||||
|
github.com/libp2p/go-libp2p/core v0.43.0-rc2 h1:1X1aDJNWhMfodJ/ynbaGLkgnC8f+hfBIqQDrzxFZOqI=
|
||||||
|
github.com/libp2p/go-libp2p/core v0.43.0-rc2/go.mod h1:NYeJ9lvyBv9nbDk2IuGb8gFKEOkIv/W5YRIy1pAJB2Q=
|
||||||
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||||
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
@@ -107,57 +115,39 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ
|
|||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE=
|
||||||
github.com/nats-io/nats.go v1.36.0 h1:suEUPuWzTSse/XhESwqLxXGuj8vGRuPRoG7MoRN/qyU=
|
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
|
||||||
github.com/nats-io/nats.go v1.36.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
|
||||||
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||||
|
github.com/nats-io/nats.go v1.37.0 h1:07rauXbVnnJvv1gfIyghFEo6lUcYRY0WXc3x7x0vUxE=
|
||||||
|
github.com/nats-io/nats.go v1.37.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
|
||||||
github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI=
|
github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI=
|
||||||
github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc=
|
github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc=
|
||||||
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
|
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
|
||||||
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
|
||||||
github.com/ogier/pflag v0.0.1/go.mod h1:zkFki7tvTa0tafRvTBIZTvzYyAu6kQhPZFnshFFPE+g=
|
github.com/ogier/pflag v0.0.1/go.mod h1:zkFki7tvTa0tafRvTBIZTvzYyAu6kQhPZFnshFFPE+g=
|
||||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
|
||||||
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
|
|
||||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
|
||||||
github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
|
||||||
github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys=
|
github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys=
|
||||||
github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
|
|
||||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
|
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
|
||||||
github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw=
|
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
|
||||||
github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
|
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
||||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
|
||||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc=
|
||||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw=
|
||||||
github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
|
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||||
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
|
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||||
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||||
github.com/prometheus/common v0.41.0 h1:npo01n6vUlRViIj5fgwiK8vlNIh8bnoxqh3gypKsyAw=
|
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
|
||||||
github.com/prometheus/common v0.41.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc=
|
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
|
||||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
||||||
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 h1:v9ezJDHA1XGxViAUSIoO/Id7Fl63u6d0YmsAm+/p2hs=
|
||||||
github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI=
|
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02/go.mod h1:RF16/A3L0xSa0oSERcnhd8Pu3IXSDZSK2gmGIMsttFE=
|
||||||
github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
|
|
||||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
|
||||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
|
||||||
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
|
|
||||||
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 h1:DAYUYH5869yV94zvCES9F51oYtN5oGlwjxJJz7ZCnik=
|
|
||||||
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
|
|
||||||
github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
|
|
||||||
github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s=
|
|
||||||
github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
|
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
|
||||||
github.com/skarademir/naturalsort v0.0.0-20150715044055-69a5d87bef62/go.mod h1:oIdVclZaltY1Nf7OQUkg1/2jImBJ+ZfKZuDIRSwk3p0=
|
github.com/skarademir/naturalsort v0.0.0-20150715044055-69a5d87bef62/go.mod h1:oIdVclZaltY1Nf7OQUkg1/2jImBJ+ZfKZuDIRSwk3p0=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=
|
github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=
|
||||||
@@ -165,83 +155,119 @@ github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYl
|
|||||||
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
|
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
|
||||||
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
|
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
|
||||||
github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/wendal/errors v0.0.0-20181209125328-7f31f4b264ec/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
|
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
||||||
github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
|
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
|
||||||
|
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
|
||||||
|
github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8=
|
||||||
|
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
|
||||||
|
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM=
|
||||||
|
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI=
|
||||||
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
|
go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHyIM=
|
||||||
|
go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4=
|
||||||
|
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||||
|
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||||
|
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||||
|
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||||
|
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
|
||||||
|
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
|
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||||
|
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||||
|
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
|
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
|
||||||
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
|
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
||||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
|
||||||
|
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
|
||||||
|
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
|
||||||
|
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
|
||||||
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
|
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
|
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
|
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
||||||
|
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
|
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
||||||
|
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
|
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
|
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
|
||||||
|
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
|
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||||
|
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
|
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||||
|
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||||
|
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
|
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||||
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
|
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
|
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
||||||
|
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||||
|
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
||||||
|
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
|
||||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
|
||||||
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
|
|
||||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
|
|
||||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
|
||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
|
||||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|||||||
12
index.html
Normal file
12
index.html
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
Hostname: a3ff4096def1
|
||||||
|
IP: 127.0.0.1
|
||||||
|
IP: 172.18.0.16
|
||||||
|
RemoteAddr: 172.18.0.1:46314
|
||||||
|
GET / HTTP/1.1
|
||||||
|
Host: localhost:5000
|
||||||
|
User-Agent: Wget/1.20.3 (linux-gnu)
|
||||||
|
Accept: */*
|
||||||
|
Accept-Encoding: identity
|
||||||
|
Connection: Keep-Alive
|
||||||
|
X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb
|
||||||
|
|
||||||
119
infrastructure/auth_connector/auth_connector.go
Normal file
119
infrastructure/auth_connector/auth_connector.go
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
package auth_connectors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"oc-auth/conf"
|
||||||
|
"oc-auth/infrastructure/claims"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AuthConnector interface {
|
||||||
|
Status() tools.State
|
||||||
|
|
||||||
|
// Login/Consent Provider endpoints (Hydra redirects here)
|
||||||
|
GetLoginChallenge(challenge string) (*LoginChallenge, error)
|
||||||
|
AcceptLogin(challenge string, subject string) (*Redirect, error)
|
||||||
|
RejectLogin(challenge string, reason string) (*Redirect, error)
|
||||||
|
GetConsentChallenge(challenge string) (*ConsentChallenge, error)
|
||||||
|
AcceptConsent(challenge string, grantScope []string, session claims.Claims) (*Redirect, error)
|
||||||
|
|
||||||
|
// Logout Provider endpoints (Hydra redirects here)
|
||||||
|
GetLogoutChallenge(challenge string) (*LogoutChallenge, error)
|
||||||
|
AcceptLogout(challenge string) (*Redirect, error)
|
||||||
|
|
||||||
|
// Token operations
|
||||||
|
Introspect(token string) (*IntrospectResult, error)
|
||||||
|
RevokeToken(token string, clientID string) error
|
||||||
|
RefreshToken(refreshToken string, clientID string) (*TokenResponse, error)
|
||||||
|
|
||||||
|
// Forward auth
|
||||||
|
CheckAuthForward(reqToken string, publicKey string, host string, method string, forward string, external bool) bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Token is the unified token response returned to clients
|
||||||
|
type Token struct {
|
||||||
|
Active bool `json:"active"`
|
||||||
|
AccessToken string `json:"access_token"`
|
||||||
|
RefreshToken string `json:"refresh_token,omitempty"`
|
||||||
|
IDToken string `json:"id_token,omitempty"`
|
||||||
|
ExpiresIn int64 `json:"expires_in"`
|
||||||
|
TokenType string `json:"token_type"`
|
||||||
|
Scope string `json:"scope,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoginRequest is the body of POST /oc/login
|
||||||
|
type LoginRequest struct {
|
||||||
|
Username string `json:"username"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
LoginChallenge string `json:"login_challenge"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Redirect is a response containing a redirect URL from Hydra
|
||||||
|
type Redirect struct {
|
||||||
|
RedirectTo string `json:"redirect_to"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoginChallenge contains the details of a Hydra login challenge
|
||||||
|
type LoginChallenge struct {
|
||||||
|
Skip bool `json:"skip"`
|
||||||
|
Subject string `json:"subject"`
|
||||||
|
Challenge string `json:"challenge"`
|
||||||
|
Client map[string]interface{} `json:"client"`
|
||||||
|
RequestURL string `json:"request_url"`
|
||||||
|
SessionID string `json:"session_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// LogoutChallenge contains the details of a Hydra logout challenge
|
||||||
|
type LogoutChallenge struct {
|
||||||
|
Subject string `json:"subject"`
|
||||||
|
SessionID string `json:"sid"`
|
||||||
|
RequestURL string `json:"request_url"`
|
||||||
|
RPInitiated bool `json:"rp_initiated"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConsentChallenge contains the details of a Hydra consent challenge
|
||||||
|
type ConsentChallenge struct {
|
||||||
|
Skip bool `json:"skip"`
|
||||||
|
Subject string `json:"subject"`
|
||||||
|
Challenge string `json:"challenge"`
|
||||||
|
RequestedScope []string `json:"requested_scope"`
|
||||||
|
RequestedAccessTokenAud []string `json:"requested_access_token_audience"`
|
||||||
|
Client map[string]interface{} `json:"client"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TokenResponse is the OAuth2 token response from Hydra
|
||||||
|
type TokenResponse struct {
|
||||||
|
AccessToken string `json:"access_token"`
|
||||||
|
TokenType string `json:"token_type"`
|
||||||
|
ExpiresIn int64 `json:"expires_in"`
|
||||||
|
RefreshToken string `json:"refresh_token,omitempty"`
|
||||||
|
IDToken string `json:"id_token,omitempty"`
|
||||||
|
Scope string `json:"scope"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// IntrospectResult is the OAuth2 introspection response from Hydra
|
||||||
|
type IntrospectResult struct {
|
||||||
|
Active bool `json:"active"`
|
||||||
|
Sub string `json:"sub,omitempty"`
|
||||||
|
ClientID string `json:"client_id,omitempty"`
|
||||||
|
Scope string `json:"scope,omitempty"`
|
||||||
|
ExpiresAt int64 `json:"exp,omitempty"`
|
||||||
|
TokenType string `json:"token_type,omitempty"`
|
||||||
|
Extra map[string]interface{} `json:"ext,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var a = map[string]AuthConnector{
|
||||||
|
"hydra": &HydraConnector{
|
||||||
|
Caller: tools.NewHTTPCaller(map[tools.DataType]map[tools.METHOD]string{}),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetAuthConnector() AuthConnector {
|
||||||
|
for k := range a {
|
||||||
|
if strings.Contains(conf.GetConfig().Auth, k) {
|
||||||
|
return a[k]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
366
infrastructure/auth_connector/hydra_connector.go
Normal file
366
infrastructure/auth_connector/hydra_connector.go
Normal file
@@ -0,0 +1,366 @@
|
|||||||
|
package auth_connectors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"oc-auth/conf"
|
||||||
|
"oc-auth/infrastructure/claims"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
oclib "cloud.o-forge.io/core/oc-lib"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/peer"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
|
)
|
||||||
|
|
||||||
|
type HydraConnector struct {
|
||||||
|
Caller *tools.HTTPCaller
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *HydraConnector) Status() tools.State {
|
||||||
|
caller := tools.NewHTTPCaller(map[tools.DataType]map[tools.METHOD]string{})
|
||||||
|
var responseBody map[string]interface{}
|
||||||
|
host := conf.GetConfig().AuthConnectPublicHost
|
||||||
|
if conf.GetConfig().Local {
|
||||||
|
host = "localhost"
|
||||||
|
}
|
||||||
|
port := fmt.Sprintf("%v", conf.GetConfig().AuthConnectorPort)
|
||||||
|
resp, err := caller.CallGet("http://"+host+":"+port, "/health/ready")
|
||||||
|
if err != nil {
|
||||||
|
return tools.DEAD
|
||||||
|
}
|
||||||
|
err = json.Unmarshal(resp, &responseBody)
|
||||||
|
if err != nil || responseBody["status"] != "ok" {
|
||||||
|
return tools.DEAD
|
||||||
|
}
|
||||||
|
return tools.ALIVE
|
||||||
|
}
|
||||||
|
|
||||||
|
// getPath builds the base URL for Hydra API calls
|
||||||
|
func (h *HydraConnector) getPath(isAdmin bool, isOauth bool) string {
|
||||||
|
host := conf.GetConfig().AuthConnectPublicHost
|
||||||
|
if isAdmin {
|
||||||
|
host = conf.GetConfig().AuthConnectorHost
|
||||||
|
}
|
||||||
|
if conf.GetConfig().Local {
|
||||||
|
host = "localhost"
|
||||||
|
}
|
||||||
|
port := fmt.Sprintf("%v", conf.GetConfig().AuthConnectorPort)
|
||||||
|
if isAdmin {
|
||||||
|
port = fmt.Sprintf("%v", conf.GetConfig().AuthConnectorAdminPort)
|
||||||
|
}
|
||||||
|
oauth := ""
|
||||||
|
if isOauth {
|
||||||
|
oauth = "/oauth2"
|
||||||
|
}
|
||||||
|
return "http://" + host + ":" + port + oauth
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLoginChallenge retrieves login challenge details from Hydra admin API
|
||||||
|
func (h *HydraConnector) GetLoginChallenge(challenge string) (*LoginChallenge, error) {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
resp, err := h.Caller.CallGet(h.getPath(true, true), "/auth/requests/login?login_challenge="+url.QueryEscape(challenge))
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to get login challenge: " + err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var result LoginChallenge
|
||||||
|
if err := json.Unmarshal(resp, &result); err != nil {
|
||||||
|
logger.Error().Msg("Failed to unmarshal login challenge: " + err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AcceptLogin accepts a login challenge after LDAP authentication
|
||||||
|
func (h *HydraConnector) AcceptLogin(challenge string, subject string) (*Redirect, error) {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
body := map[string]interface{}{
|
||||||
|
"subject": subject,
|
||||||
|
"remember": true,
|
||||||
|
"remember_for": 3600,
|
||||||
|
}
|
||||||
|
resp, err := h.Caller.CallRaw(http.MethodPut,
|
||||||
|
h.getPath(true, true), "/auth/requests/login/accept?login_challenge="+url.QueryEscape(challenge),
|
||||||
|
body, "application/json", true)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to accept login challenge: " + err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
b, err := io.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if resp.StatusCode >= 300 {
|
||||||
|
return nil, errors.New("hydra accept login returned status " + resp.Status + ": " + string(b))
|
||||||
|
}
|
||||||
|
var redirect Redirect
|
||||||
|
if err := json.Unmarshal(b, &redirect); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &redirect, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RejectLogin rejects a login challenge
|
||||||
|
func (h *HydraConnector) RejectLogin(challenge string, reason string) (*Redirect, error) {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
body := map[string]interface{}{
|
||||||
|
"error": "access_denied",
|
||||||
|
"error_description": reason,
|
||||||
|
}
|
||||||
|
resp, err := h.Caller.CallRaw(http.MethodPut,
|
||||||
|
h.getPath(true, true), "/auth/requests/login/reject?login_challenge="+url.QueryEscape(challenge),
|
||||||
|
body, "application/json", true)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to reject login challenge: " + err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
b, err := io.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var redirect Redirect
|
||||||
|
if err := json.Unmarshal(b, &redirect); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &redirect, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLogoutChallenge retrieves logout challenge details from Hydra admin API
|
||||||
|
func (h *HydraConnector) GetLogoutChallenge(challenge string) (*LogoutChallenge, error) {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
resp, err := h.Caller.CallGet(h.getPath(true, true), "/auth/requests/logout?logout_challenge="+url.QueryEscape(challenge))
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to get logout challenge: " + err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var result LogoutChallenge
|
||||||
|
if err := json.Unmarshal(resp, &result); err != nil {
|
||||||
|
logger.Error().Msg("Failed to unmarshal logout challenge: " + err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AcceptLogout accepts a logout challenge — invalidates the Hydra session
|
||||||
|
func (h *HydraConnector) AcceptLogout(challenge string) (*Redirect, error) {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
resp, err := h.Caller.CallRaw(http.MethodPut,
|
||||||
|
h.getPath(true, true), "/auth/requests/logout/accept?logout_challenge="+url.QueryEscape(challenge),
|
||||||
|
nil, "application/json", true)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to accept logout challenge: " + err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
b, err := io.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if resp.StatusCode >= 300 {
|
||||||
|
return nil, errors.New("hydra accept logout returned status " + resp.Status + ": " + string(b))
|
||||||
|
}
|
||||||
|
var redirect Redirect
|
||||||
|
if err := json.Unmarshal(b, &redirect); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &redirect, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetConsentChallenge retrieves consent challenge details from Hydra admin API
|
||||||
|
func (h *HydraConnector) GetConsentChallenge(challenge string) (*ConsentChallenge, error) {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
resp, err := h.Caller.CallGet(h.getPath(true, true), "/auth/requests/consent?consent_challenge="+url.QueryEscape(challenge))
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to get consent challenge: " + err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var result ConsentChallenge
|
||||||
|
if err := json.Unmarshal(resp, &result); err != nil {
|
||||||
|
logger.Error().Msg("Failed to unmarshal consent challenge: " + err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AcceptConsent accepts a consent challenge with claims injected into the Hydra session
|
||||||
|
func (h *HydraConnector) AcceptConsent(challenge string, grantScope []string, session claims.Claims) (*Redirect, error) {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
body := map[string]interface{}{
|
||||||
|
"grant_scope": grantScope,
|
||||||
|
"grant_access_token_audience": grantScope, // grant requested audience
|
||||||
|
"remember": true,
|
||||||
|
"remember_for": 3600,
|
||||||
|
"session": map[string]interface{}{
|
||||||
|
"access_token": session.Session.AccessToken,
|
||||||
|
"id_token": session.Session.IDToken,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
resp, err := h.Caller.CallRaw(http.MethodPut,
|
||||||
|
h.getPath(true, true), "/auth/requests/consent/accept?consent_challenge="+url.QueryEscape(challenge),
|
||||||
|
body, "application/json", true)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to accept consent challenge: " + err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
b, err := io.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if resp.StatusCode >= 300 {
|
||||||
|
return nil, errors.New("hydra accept consent returned status " + resp.Status + ": " + string(b))
|
||||||
|
}
|
||||||
|
var redirect Redirect
|
||||||
|
if err := json.Unmarshal(b, &redirect); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &redirect, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Introspect verifies a token with Hydra — respects the actual response (no override)
|
||||||
|
func (h *HydraConnector) Introspect(token string) (*IntrospectResult, error) {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
urls := url.Values{}
|
||||||
|
urls.Add("token", token)
|
||||||
|
resp, err := h.Caller.CallForm(http.MethodPost, h.getPath(true, true), "/introspect", urls,
|
||||||
|
"application/x-www-form-urlencoded", true)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to introspect token: " + err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
b, err := io.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if resp.StatusCode >= 300 {
|
||||||
|
return nil, errors.New("hydra introspect returned status " + resp.Status)
|
||||||
|
}
|
||||||
|
var result IntrospectResult
|
||||||
|
if err := json.Unmarshal(b, &result); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeToken revokes an OAuth2 token
|
||||||
|
func (h *HydraConnector) RevokeToken(token string, clientID string) error {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
urls := url.Values{}
|
||||||
|
urls.Add("token", token)
|
||||||
|
urls.Add("client_id", clientID)
|
||||||
|
urls.Add("client_secret", conf.GetConfig().ClientSecret)
|
||||||
|
resp, err := h.Caller.CallForm(http.MethodPost, h.getPath(false, true), "/revoke", urls,
|
||||||
|
"application/x-www-form-urlencoded", true)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to revoke token: " + err.Error())
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
if resp.StatusCode >= 300 {
|
||||||
|
b, _ := io.ReadAll(resp.Body)
|
||||||
|
return errors.New("hydra revoke returned status " + resp.Status + ": " + string(b))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RefreshToken exchanges a refresh_token for a new token set
|
||||||
|
func (h *HydraConnector) RefreshToken(refreshToken string, clientID string) (*TokenResponse, error) {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
urls := url.Values{}
|
||||||
|
urls.Add("grant_type", "refresh_token")
|
||||||
|
urls.Add("refresh_token", refreshToken)
|
||||||
|
urls.Add("client_id", clientID)
|
||||||
|
urls.Add("client_secret", conf.GetConfig().ClientSecret)
|
||||||
|
resp, err := h.Caller.CallForm(http.MethodPost, h.getPath(false, true), "/token", urls,
|
||||||
|
"application/x-www-form-urlencoded", true)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to refresh token: " + err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
b, err := io.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if resp.StatusCode >= 300 {
|
||||||
|
return nil, errors.New("hydra refresh returned status " + resp.Status + ": " + string(b))
|
||||||
|
}
|
||||||
|
var result TokenResponse
|
||||||
|
if err := json.Unmarshal(b, &result); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// CheckAuthForward validates a JWT token for forward auth (Traefik integration)
|
||||||
|
// It introspects the token via Hydra and checks permissions from the token's extra claims
|
||||||
|
func (h *HydraConnector) CheckAuthForward(reqToken string, publicKey string, host string, method string, forward string, external bool) bool {
|
||||||
|
if forward == "" || method == "" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
|
||||||
|
// Introspect the token via Hydra to get claims
|
||||||
|
result, err := h.Introspect(reqToken)
|
||||||
|
if err != nil || !result.Active {
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Forward auth introspect failed: " + err.Error())
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract claims from the introspection result's extra data
|
||||||
|
// Hydra puts consent session's access_token data in the "ext" field of introspection
|
||||||
|
var sessionClaims claims.Claims
|
||||||
|
if result.Extra != nil {
|
||||||
|
sessionClaims.Session.AccessToken = make(map[string]interface{})
|
||||||
|
sessionClaims.Session.IDToken = make(map[string]interface{})
|
||||||
|
for k, v := range result.Extra {
|
||||||
|
sessionClaims.Session.AccessToken[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Also try to get id_token claims from the token if it's a JWT
|
||||||
|
// For now, use the introspected extra claims and the peer signature verification
|
||||||
|
if sessionClaims.Session.IDToken == nil {
|
||||||
|
sessionClaims.Session.IDToken = make(map[string]interface{})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get self peer for signature verification
|
||||||
|
pp := oclib.NewRequest(oclib.LibDataEnum(oclib.PEER), "", "", []string{}, nil).Search(nil, fmt.Sprintf("%v", peer.SELF.EnumIndex()), false)
|
||||||
|
if len(pp.Data) > 0 {
|
||||||
|
p := pp.Data[0].(*peer.Peer)
|
||||||
|
// Re-sign for local verification if this is our own peer
|
||||||
|
if !external && p.PublicKey == publicKey {
|
||||||
|
sessionClaims.Session.IDToken["signature"] = ""
|
||||||
|
// For internal requests, skip signature check by using the claims decoder directly
|
||||||
|
ok, err := claims.GetClaims().DecodeClaimsInToken(host, method, forward, sessionClaims, publicKey, external)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to decode claims: " + err.Error())
|
||||||
|
}
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ok, err := claims.GetClaims().DecodeClaimsInToken(host, method, forward, sessionClaims, publicKey, external)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to decode claims: " + err.Error())
|
||||||
|
}
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
// extractBearerToken extracts the token from a "Bearer xxx" Authorization header value
|
||||||
|
func extractBearerToken(authHeader string) string {
|
||||||
|
splitToken := strings.Split(authHeader, "Bearer ")
|
||||||
|
if len(splitToken) < 2 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return splitToken[1]
|
||||||
|
}
|
||||||
494
infrastructure/auth_connector/ldap.go
Normal file
494
infrastructure/auth_connector/ldap.go
Normal file
@@ -0,0 +1,494 @@
|
|||||||
|
package auth_connectors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"crypto/tls"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"net"
|
||||||
|
"oc-auth/conf"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
oclib "cloud.o-forge.io/core/oc-lib"
|
||||||
|
"github.com/coocood/freecache"
|
||||||
|
"github.com/go-ldap/ldap/v3"
|
||||||
|
"github.com/i-core/rlog"
|
||||||
|
"go.uber.org/zap"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// errInvalidCredentials is an error that happens when a user's password is invalid.
|
||||||
|
errInvalidCredentials = fmt.Errorf("invalid credentials")
|
||||||
|
// errConnectionTimeout is an error that happens when no one LDAP endpoint responds.
|
||||||
|
errConnectionTimeout = fmt.Errorf("connection timeout")
|
||||||
|
// errMissedUsername is an error that happens
|
||||||
|
errMissedUsername = errors.New("username is missed")
|
||||||
|
// errUnknownUsername is an error that happens
|
||||||
|
errUnknownUsername = errors.New("unknown username")
|
||||||
|
)
|
||||||
|
|
||||||
|
type conn interface {
|
||||||
|
Bind(bindDN, password string) error
|
||||||
|
SearchRoles(attrs ...string) ([]map[string][]string, error)
|
||||||
|
SearchUser(user string, attrs ...string) ([]map[string][]string, error)
|
||||||
|
SearchUserRoles(user string, attrs ...string) ([]map[string][]string, error)
|
||||||
|
Close() error
|
||||||
|
}
|
||||||
|
|
||||||
|
type connector interface {
|
||||||
|
Connect(ctx context.Context, addr string) (conn, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Config is a LDAP configuration.
|
||||||
|
type Config struct {
|
||||||
|
Endpoints []string `envconfig:"endpoints" required:"true" desc:"a LDAP's server URLs as \"<address>:<port>\""`
|
||||||
|
BindDN string `envconfig:"binddn" desc:"a LDAP bind DN"`
|
||||||
|
BindPass string `envconfig:"bindpw" json:"-" desc:"a LDAP bind password"`
|
||||||
|
BaseDN string `envconfig:"basedn" required:"true" desc:"a LDAP base DN for searching users"`
|
||||||
|
AttrClaims map[string]string `envconfig:"attr_claims" default:"name:name,sn:family_name,givenName:given_name,mail:email" desc:"a mapping of LDAP attributes to OpenID connect claims"`
|
||||||
|
UserBaseDN string `envconfig:"user_basedn" required:"true" desc:"a LDAP base DN for searching users"`
|
||||||
|
RoleBaseDN string `envconfig:"role_basedn" required:"true" desc:"a LDAP base DN for searching roles"`
|
||||||
|
RoleAttr string `envconfig:"role_attr" default:"description" desc:"a LDAP group's attribute that contains a role's name"`
|
||||||
|
RoleClaim string `envconfig:"role_claim" default:"https://github.com/i-core/werther/claims/roles" desc:"a name of an OpenID Connect claim that contains user roles"`
|
||||||
|
CacheSize int `envconfig:"cache_size" default:"512" desc:"a user info cache's size in KiB"`
|
||||||
|
CacheTTL time.Duration `envconfig:"cache_ttl" default:"30m" desc:"a user info cache TTL"`
|
||||||
|
IsTLS bool `envconfig:"is_tls" default:"false" desc:"should LDAP connection be established via TLS"`
|
||||||
|
FlatRoleClaims bool `envconfig:"flat_role_claims" desc:"add roles claim as single list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new LDAP client.
|
||||||
|
func New() *Client {
|
||||||
|
cnf := Config{
|
||||||
|
Endpoints: strings.Split(conf.GetConfig().LDAPEndpoints, ","),
|
||||||
|
BindDN: conf.GetConfig().LDAPBindDN,
|
||||||
|
BindPass: conf.GetConfig().LDAPBindPW,
|
||||||
|
BaseDN: conf.GetConfig().LDAPBaseDN,
|
||||||
|
UserBaseDN: conf.GetConfig().LDAPUserBaseDN,
|
||||||
|
RoleBaseDN: conf.GetConfig().LDAPRoleBaseDN,
|
||||||
|
}
|
||||||
|
return &Client{
|
||||||
|
Config: cnf,
|
||||||
|
connector: &ldapConnector{BaseDN: cnf.BaseDN, RoleBaseDN: cnf.RoleBaseDN, UserBaseDN: cnf.UserBaseDN, IsTLS: cnf.IsTLS},
|
||||||
|
cache: freecache.NewCache(cnf.CacheSize * 1024),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type Client struct {
|
||||||
|
Config
|
||||||
|
connector connector
|
||||||
|
cache *freecache.Cache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cli *Client) Authenticate(ctx context.Context, username string, password string) (bool, error) {
|
||||||
|
if username == "" || password == "" {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
var cancel context.CancelFunc
|
||||||
|
ctx, cancel = context.WithCancel(ctx)
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
logger.Debug().Msgf("LDAP authenticate user: %s", username)
|
||||||
|
cn, ok := <-cli.connect(ctx)
|
||||||
|
cancel()
|
||||||
|
if !ok {
|
||||||
|
return false, errConnectionTimeout
|
||||||
|
}
|
||||||
|
defer cn.Close()
|
||||||
|
// Find a user DN by his or her username.
|
||||||
|
details, err := cli.findBasicUserDetails(cn, username, []string{"dn"})
|
||||||
|
if err != nil || details == nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
a := details["dn"]
|
||||||
|
logger.Debug().Msgf("Binding DN: %s", a[0])
|
||||||
|
if err := cn.Bind(a[0], password); err != nil {
|
||||||
|
logger.Error().Msg("LDAP bind failed: " + err.Error())
|
||||||
|
if err == errInvalidCredentials {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear the claims' cache because of possible re-authentication. We don't want stale claims after re-login.
|
||||||
|
if ok := cli.cache.Del([]byte(username)); ok {
|
||||||
|
log := rlog.FromContext(ctx)
|
||||||
|
log.Debug("Cleared user's OIDC claims in the cache")
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cli *Client) GetRoles(ctx context.Context) (map[string]LDAPRoles, error) {
|
||||||
|
var cancel context.CancelFunc
|
||||||
|
ctx, cancel = context.WithCancel(ctx)
|
||||||
|
|
||||||
|
cn, ok := <-cli.connect(ctx)
|
||||||
|
cancel()
|
||||||
|
if !ok {
|
||||||
|
return map[string]LDAPRoles{}, errConnectionTimeout
|
||||||
|
}
|
||||||
|
defer cn.Close()
|
||||||
|
|
||||||
|
// Find a user DN by his or her username.
|
||||||
|
return cli.findRoles(cn, "dn", "member", "uniqueMember")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Claim is the FindOIDCClaims result struct
|
||||||
|
type LDAPClaim struct {
|
||||||
|
Code string // the root claim name
|
||||||
|
Name string // the claim name
|
||||||
|
Value interface{} // the value
|
||||||
|
}
|
||||||
|
|
||||||
|
type LDAPRoles struct {
|
||||||
|
Members map[string][]string
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindOIDCClaims finds all OIDC claims for a user.
|
||||||
|
func (cli *Client) FindOIDCClaims(ctx context.Context, username string) ([]LDAPClaim, error) {
|
||||||
|
if username == "" {
|
||||||
|
return nil, errMissedUsername
|
||||||
|
}
|
||||||
|
|
||||||
|
log := rlog.FromContext(ctx).Sugar()
|
||||||
|
|
||||||
|
// Retrieving from LDAP is slow. So, we try to get claims for the given username from the cache.
|
||||||
|
switch cdata, err := cli.cache.Get([]byte(username)); err {
|
||||||
|
case nil:
|
||||||
|
var claims []LDAPClaim
|
||||||
|
if err = json.Unmarshal(cdata, &claims); err != nil {
|
||||||
|
log.Info("Failed to unmarshal user's OIDC claims", zap.Error(err), "data", cdata)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
log.Debugw("Retrieved user's OIDC claims from the cache", "claims", claims)
|
||||||
|
return claims, nil
|
||||||
|
case freecache.ErrNotFound:
|
||||||
|
log.Debug("User's OIDC claims is not found in the cache")
|
||||||
|
default:
|
||||||
|
log.Infow("Failed to retrieve user's OIDC claims from the cache", zap.Error(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to make multiple TCP connections to the LDAP server for getting claims.
|
||||||
|
// Accept the first one, and cancel others.
|
||||||
|
var cancel context.CancelFunc
|
||||||
|
ctx, cancel = context.WithCancel(ctx)
|
||||||
|
|
||||||
|
cn, ok := <-cli.connect(ctx)
|
||||||
|
cancel()
|
||||||
|
if !ok {
|
||||||
|
return nil, errConnectionTimeout
|
||||||
|
}
|
||||||
|
defer cn.Close()
|
||||||
|
|
||||||
|
// We need to find LDAP attribute's names for all required claims.
|
||||||
|
attrs := []string{"dn"}
|
||||||
|
for k := range cli.AttrClaims {
|
||||||
|
attrs = append(attrs, k)
|
||||||
|
}
|
||||||
|
// Find the attributes in the LDAP server.
|
||||||
|
details, err := cli.findBasicUserDetails(cn, username, attrs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if details == nil {
|
||||||
|
return nil, errUnknownUsername
|
||||||
|
}
|
||||||
|
log.Infow("Retrieved user's info from LDAP", "details", details)
|
||||||
|
|
||||||
|
// Transform the retrieved attributes to corresponding claims.
|
||||||
|
claims := make([]LDAPClaim, 0, len(details))
|
||||||
|
for attr, v := range details {
|
||||||
|
if claim, ok := cli.AttrClaims[attr]; ok {
|
||||||
|
claims = append(claims, LDAPClaim{claim, claim, v})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// User's roles is stored in LDAP as groups. We find all groups in a role's DN
|
||||||
|
// that include the user as a member.
|
||||||
|
entries, err := cn.SearchUserRoles(fmt.Sprintf("%s", details["dn"]), "dn", cli.RoleAttr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
roles := make(map[string]interface{})
|
||||||
|
for _, entry := range entries {
|
||||||
|
roleDNs, ok := entry["dn"]
|
||||||
|
if !ok || len(roleDNs) == 0 {
|
||||||
|
log.Infow("No required LDAP attribute for a role", "ldapAttribute", "dn", "entry", entry)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
roleDN := roleDNs[0]
|
||||||
|
if entry[cli.RoleAttr] == nil {
|
||||||
|
log.Infow("No required LDAP attribute for a role", "ldapAttribute", cli.RoleAttr, "roleDN", roleDN)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure that a role's DN is inside of the role's base DN.
|
||||||
|
// It's sufficient to compare the DN's suffix with the base DN.
|
||||||
|
n, k := len(roleDN), len(cli.RoleBaseDN)
|
||||||
|
if n < k || !strings.EqualFold(roleDN[n-k:], cli.RoleBaseDN) {
|
||||||
|
return nil, errors.New("You should never see that")
|
||||||
|
}
|
||||||
|
// The DN without the role's base DN must contain a CN and OU
|
||||||
|
// where the CN is for uniqueness only, and the OU is an application id.
|
||||||
|
path := strings.Split(roleDN[:n-k-1], ",")
|
||||||
|
if len(path) != 2 {
|
||||||
|
log.Infow("A role's DN without the role's base DN must contain two nodes only",
|
||||||
|
"roleBaseDN", cli.RoleBaseDN, "roleDN", roleDN)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
appID := path[1][len("OU="):]
|
||||||
|
|
||||||
|
var appRoles []interface{}
|
||||||
|
if v := roles[appID]; v != nil {
|
||||||
|
appRoles = v.([]interface{})
|
||||||
|
}
|
||||||
|
appRoles = append(appRoles, entry[cli.RoleAttr])
|
||||||
|
roles[appID] = appRoles
|
||||||
|
}
|
||||||
|
|
||||||
|
claims = append(claims, LDAPClaim{cli.RoleClaim, cli.RoleClaim, roles})
|
||||||
|
|
||||||
|
if cli.FlatRoleClaims {
|
||||||
|
for appID, appRoles := range roles {
|
||||||
|
claims = append(claims, LDAPClaim{cli.RoleClaim, cli.RoleClaim + "/" + appID, appRoles})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the claims in the cache for future queries.
|
||||||
|
cdata, err := json.Marshal(claims)
|
||||||
|
if err != nil {
|
||||||
|
log.Infow("Failed to marshal user's OIDC claims for caching", zap.Error(err), "claims", claims)
|
||||||
|
}
|
||||||
|
if err = cli.cache.Set([]byte(username), cdata, int(cli.CacheTTL.Seconds())); err != nil {
|
||||||
|
log.Infow("Failed to store user's OIDC claims into the cache", zap.Error(err), "claims", claims)
|
||||||
|
}
|
||||||
|
|
||||||
|
return claims, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cli *Client) connect(ctx context.Context) <-chan conn {
|
||||||
|
var (
|
||||||
|
wg sync.WaitGroup
|
||||||
|
ch = make(chan conn)
|
||||||
|
)
|
||||||
|
wg.Add(len(cli.Endpoints))
|
||||||
|
for _, addr := range cli.Endpoints {
|
||||||
|
go func(addr string) {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
|
cn, err := cli.connector.Connect(ctx, addr)
|
||||||
|
if err != nil {
|
||||||
|
log := oclib.GetLogger()
|
||||||
|
log.Error().Msgf("Failed to create LDAP connection to %s: %v", addr, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
cn.Close()
|
||||||
|
log := oclib.GetLogger()
|
||||||
|
log.Debug().Msgf("LDAP connection cancelled: %s", addr)
|
||||||
|
return
|
||||||
|
case ch <- cn:
|
||||||
|
}
|
||||||
|
}(addr)
|
||||||
|
}
|
||||||
|
go func() {
|
||||||
|
wg.Wait()
|
||||||
|
close(ch)
|
||||||
|
}()
|
||||||
|
return ch
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cli *Client) findRoles(cn conn, attrs ...string) (map[string]LDAPRoles, error) {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
logger.Debug().Msg("Finding LDAP roles")
|
||||||
|
if cli.BindDN != "" {
|
||||||
|
// We need to login to a LDAP server with a service account for retrieving user data.
|
||||||
|
if err := cn.Bind(cli.BindDN, cli.BindPass); err != nil {
|
||||||
|
return map[string]LDAPRoles{}, errors.New(err.Error() + " : failed to login to a LDAP woth a service account")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
entries, err := cn.SearchRoles(attrs...)
|
||||||
|
logger.Debug().Msgf("Found %d LDAP role entries", len(entries))
|
||||||
|
if err != nil {
|
||||||
|
return map[string]LDAPRoles{}, err
|
||||||
|
}
|
||||||
|
claims := map[string]LDAPRoles{}
|
||||||
|
for _, entry := range entries {
|
||||||
|
roleDNs, ok := entry["dn"]
|
||||||
|
if !ok || len(roleDNs) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
roleDN := roleDNs[0]
|
||||||
|
// Ensure that a role's DN is inside of the role's base DN.
|
||||||
|
// It's sufficient to compare the DN's suffix with the base DN.
|
||||||
|
n, k := len(roleDN), len(cli.RoleBaseDN)
|
||||||
|
if n < k || !strings.EqualFold(roleDN[n-k:], cli.RoleBaseDN) {
|
||||||
|
return nil, errors.New("You should never see that")
|
||||||
|
}
|
||||||
|
// The DN without the role's base DN must contain a CN and OU
|
||||||
|
// where the CN is for uniqueness only, and the OU is an application id.
|
||||||
|
path := strings.Split(roleDN[:n-k-1], ",")
|
||||||
|
if len(path) != 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
appID := path[1][len("OU="):]
|
||||||
|
if _, ok := claims[appID]; !ok {
|
||||||
|
claims[appID] = LDAPRoles{
|
||||||
|
Members: map[string][]string{},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
role := path[0][len("cn="):]
|
||||||
|
if claims[appID].Members[role] == nil {
|
||||||
|
claims[appID].Members[role] = []string{}
|
||||||
|
}
|
||||||
|
logger.Debug().Msgf("Processing role entry: %v", entry["dn"])
|
||||||
|
memberDNs, ok := entry["member"]
|
||||||
|
for _, memberDN := range memberDNs {
|
||||||
|
if !ok || memberDN == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
path = strings.Split(memberDN[:n-k-1], ",")
|
||||||
|
if len(path) < 1 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
member := strings.Split(path[0][len("uid="):], ",")
|
||||||
|
claims[appID].Members[role] = append(claims[appID].Members[role], member[0])
|
||||||
|
}
|
||||||
|
memberDNs, ok = entry["uniqueMember"]
|
||||||
|
for _, memberDN := range memberDNs {
|
||||||
|
if !ok || memberDN == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
path = strings.Split(memberDN[:n-k-1], ",")
|
||||||
|
if len(path) < 1 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
member := strings.Split(path[0][len("uid="):], ",")
|
||||||
|
claims[appID].Members[role] = append(claims[appID].Members[role], member[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return claims, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// findBasicUserDetails finds user's LDAP attributes that were specified. It returns nil if no such user.
|
||||||
|
func (cli *Client) findBasicUserDetails(cn conn, username string, attrs []string) (map[string][]string, error) {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
logger.Debug().Msgf("Finding LDAP user details for: %s", username)
|
||||||
|
if cli.BindDN != "" {
|
||||||
|
// We need to login to a LDAP server with a service account for retrieving user data.
|
||||||
|
if err := cn.Bind(cli.BindDN, cli.BindPass); err != nil {
|
||||||
|
return nil, errors.New(err.Error() + " : failed to login to a LDAP woth a service account")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
entries, err := cn.SearchUser(username, attrs...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(entries) == 0 {
|
||||||
|
// We didn't find the user.
|
||||||
|
logger.Debug().Msgf("LDAP user not found: %s", username)
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
entry = entries[0]
|
||||||
|
details = make(map[string][]string)
|
||||||
|
)
|
||||||
|
for _, attr := range attrs {
|
||||||
|
if v, ok := entry[attr]; ok {
|
||||||
|
details[attr] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return details, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type ldapConnector struct {
|
||||||
|
BaseDN string
|
||||||
|
RoleBaseDN string
|
||||||
|
UserBaseDN string
|
||||||
|
IsTLS bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ldapConnector) Connect(ctx context.Context, addr string) (conn, error) {
|
||||||
|
d := net.Dialer{Timeout: ldap.DefaultTimeout}
|
||||||
|
tcpcn, err := d.DialContext(ctx, "tcp", addr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if c.IsTLS {
|
||||||
|
tlscn, err := tls.DialWithDialer(&d, "tcp", addr, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
tcpcn = tlscn
|
||||||
|
}
|
||||||
|
|
||||||
|
ldapcn := ldap.NewConn(tcpcn, c.IsTLS)
|
||||||
|
|
||||||
|
ldapcn.Start()
|
||||||
|
return &ldapConn{Conn: ldapcn, BaseDN: c.BaseDN, UserBaseDN: c.UserBaseDN, RoleBaseDN: c.RoleBaseDN}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type ldapConn struct {
|
||||||
|
*ldap.Conn
|
||||||
|
BaseDN string
|
||||||
|
UserBaseDN string
|
||||||
|
RoleBaseDN string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ldapConn) Bind(bindDN, password string) error {
|
||||||
|
err := c.Conn.Bind(bindDN, password)
|
||||||
|
if ldapErr, ok := err.(*ldap.Error); ok && ldapErr.ResultCode == ldap.LDAPResultInvalidCredentials {
|
||||||
|
return errInvalidCredentials
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ldapConn) SearchUser(user string, attrs ...string) ([]map[string][]string, error) {
|
||||||
|
query := fmt.Sprintf(
|
||||||
|
"(&(|(objectClass=organizationalPerson)(objectClass=inetOrgPerson))"+
|
||||||
|
"(|(uid=%[1]s)(mail=%[1]s)(userPrincipalName=%[1]s)(sAMAccountName=%[1]s)))", user)
|
||||||
|
return c.searchEntries(c.UserBaseDN, query, attrs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ldapConn) SearchUserRoles(user string, attrs ...string) ([]map[string][]string, error) {
|
||||||
|
query := fmt.Sprintf("(|"+
|
||||||
|
"(&(|(objectClass=group)(objectClass=groupOfNames)(objectClass=groupofnames))(member=%[1]s))"+
|
||||||
|
"(&(objectClass=groupOfUniqueNames)(uniqueMember=%[1]s))"+
|
||||||
|
")", user)
|
||||||
|
return c.searchEntries(c.RoleBaseDN, query, attrs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ldapConn) SearchRoles(attrs ...string) ([]map[string][]string, error) {
|
||||||
|
query := "(|(&(|(objectClass=group)(objectClass=groupOfNames)(objectClass=groupofnames))))"
|
||||||
|
return c.searchEntries(c.RoleBaseDN, query, attrs)
|
||||||
|
}
|
||||||
|
|
||||||
|
// searchEntries executes a LDAP query, and returns a result as entries where each entry is mapping of LDAP attributes.
|
||||||
|
func (c *ldapConn) searchEntries(baseDN, query string, attrs []string) ([]map[string][]string, error) {
|
||||||
|
log := oclib.GetLogger()
|
||||||
|
log.Debug().Msgf("LDAP search: baseDN=%s query=%s", baseDN, query)
|
||||||
|
req := ldap.NewSearchRequest(baseDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, query, attrs, nil)
|
||||||
|
res, err := c.Search(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
log.Debug().Msgf("LDAP search returned %d entries", len(res.Entries))
|
||||||
|
|
||||||
|
var entries []map[string][]string
|
||||||
|
for _, v := range res.Entries {
|
||||||
|
entry := map[string][]string{"dn": {v.DN}}
|
||||||
|
for _, attr := range v.Attributes {
|
||||||
|
// We need the first value only for the named attribute.
|
||||||
|
entry[attr.Name] = attr.Values
|
||||||
|
}
|
||||||
|
entries = append(entries, entry)
|
||||||
|
}
|
||||||
|
return entries, nil
|
||||||
|
}
|
||||||
42
infrastructure/claims/claims.go
Normal file
42
infrastructure/claims/claims.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package claims
|
||||||
|
|
||||||
|
import (
|
||||||
|
"oc-auth/conf"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/peer"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ClaimService builds and verifies OAuth2 session claims
|
||||||
|
type ClaimService interface {
|
||||||
|
// BuildConsentSession builds the session payload for Hydra consent accept.
|
||||||
|
// Claims are injected into the Hydra JWT via the consent session, not appended to the token.
|
||||||
|
BuildConsentSession(clientID string, userId string, peer *peer.Peer) Claims
|
||||||
|
|
||||||
|
// DecodeClaimsInToken verifies permissions from claims extracted from a JWT
|
||||||
|
DecodeClaimsInToken(host string, method string, forward string, sessionClaims Claims, publicKey string, external bool) (bool, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SessionClaims contains access_token and id_token claim maps
|
||||||
|
type SessionClaims struct {
|
||||||
|
AccessToken map[string]interface{} `json:"access_token"`
|
||||||
|
IDToken map[string]interface{} `json:"id_token"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Claims is the top-level session structure passed to Hydra consent accept
|
||||||
|
type Claims struct {
|
||||||
|
Session SessionClaims `json:"session"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var t = map[string]ClaimService{
|
||||||
|
"hydra": HydraClaims{},
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetClaims() ClaimService {
|
||||||
|
for k := range t {
|
||||||
|
if strings.Contains(conf.GetConfig().Auth, k) {
|
||||||
|
return t[k]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
129
infrastructure/claims/crypto.go
Normal file
129
infrastructure/claims/crypto.go
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
package claims
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto"
|
||||||
|
"crypto/rand"
|
||||||
|
"crypto/rsa"
|
||||||
|
"crypto/x509"
|
||||||
|
"encoding/base64"
|
||||||
|
"errors"
|
||||||
|
"log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SignDefault(plaintext, privateKey []byte) (signature string, err error) {
|
||||||
|
client, err := New(privateKey, nil)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
signatureByte, err := client.Sign(plaintext)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
signature = base64.StdEncoding.EncodeToString(signatureByte)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func VerifyDefault(plaintext, publicKey []byte, signature string) (err error) {
|
||||||
|
publicKeys := make(map[string][]byte)
|
||||||
|
publicKeys["default"] = publicKey
|
||||||
|
client, err := New(nil, publicKeys)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
signatureByte, err := base64.StdEncoding.DecodeString(signature)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err = client.Verify(plaintext, signatureByte, "default")
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) Sign(plaintext []byte) (signature []byte, err error) {
|
||||||
|
var opts rsa.PSSOptions
|
||||||
|
opts.SaltLength = rsa.PSSSaltLengthAuto
|
||||||
|
|
||||||
|
newhash := crypto.SHA256
|
||||||
|
pssh := newhash.New()
|
||||||
|
pssh.Write(plaintext)
|
||||||
|
hashed := pssh.Sum(nil)
|
||||||
|
signature, err = rsa.SignPSS(
|
||||||
|
rand.Reader,
|
||||||
|
c.PrivateKey,
|
||||||
|
newhash,
|
||||||
|
hashed,
|
||||||
|
&opts,
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) Verify(plaintext, signature []byte, target string) (err error) {
|
||||||
|
var opts rsa.PSSOptions
|
||||||
|
opts.SaltLength = rsa.PSSSaltLengthAuto
|
||||||
|
|
||||||
|
newhash := crypto.SHA256
|
||||||
|
pssh := newhash.New()
|
||||||
|
pssh.Write(plaintext)
|
||||||
|
hashed := pssh.Sum(nil)
|
||||||
|
err = rsa.VerifyPSS(
|
||||||
|
c.PublicKeys[target],
|
||||||
|
newhash,
|
||||||
|
hashed,
|
||||||
|
signature,
|
||||||
|
&opts,
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
||||||
|
}
|
||||||
|
|
||||||
|
type Client struct {
|
||||||
|
PrivateKey *rsa.PrivateKey
|
||||||
|
PublicKeys map[string]*rsa.PublicKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(privateKey []byte, publicKeys map[string][]byte) (client *Client, err error) {
|
||||||
|
client = &Client{}
|
||||||
|
|
||||||
|
if privateKey != nil {
|
||||||
|
validPrivateKey, errPrivate := x509.ParsePKCS1PrivateKey(privateKey)
|
||||||
|
if errPrivate != nil {
|
||||||
|
err = errPrivate
|
||||||
|
log.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
client.PrivateKey = validPrivateKey
|
||||||
|
}
|
||||||
|
|
||||||
|
if publicKeys != nil {
|
||||||
|
validPublicKeysMap := make(map[string]*rsa.PublicKey)
|
||||||
|
for k, v := range publicKeys {
|
||||||
|
validPublicKey, errPublic := x509.ParsePKCS1PublicKey(v)
|
||||||
|
if errPublic != nil {
|
||||||
|
err = errPublic
|
||||||
|
log.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if validPublicKey == nil {
|
||||||
|
err = errors.New("Invalid Public Key Type")
|
||||||
|
log.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
validPublicKeysMap[k] = validPublicKey
|
||||||
|
}
|
||||||
|
client.PublicKeys = validPublicKeysMap
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
177
infrastructure/claims/hydra_claims.go
Normal file
177
infrastructure/claims/hydra_claims.go
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
package claims
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/sha256"
|
||||||
|
"encoding/pem"
|
||||||
|
"errors"
|
||||||
|
"oc-auth/conf"
|
||||||
|
"oc-auth/infrastructure/perms_connectors"
|
||||||
|
"oc-auth/infrastructure/utils"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
oclib "cloud.o-forge.io/core/oc-lib"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/peer"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
|
)
|
||||||
|
|
||||||
|
type HydraClaims struct{}
|
||||||
|
|
||||||
|
func (h HydraClaims) generateKey(relation string, path string) (string, error) {
|
||||||
|
method, err := utils.ExtractMethod(relation, true)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
p := strings.ReplaceAll(strings.ToUpper(path), "/", "_")
|
||||||
|
return strings.ToUpper(method.String()) + "_" + strings.ReplaceAll(p, ":", ""), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// decodeKey extracts method and path from a permission key
|
||||||
|
func (h HydraClaims) decodeKey(key string, external bool) (tools.METHOD, string, error) {
|
||||||
|
s := strings.Split(key, "_")
|
||||||
|
if len(s) < 2 {
|
||||||
|
return tools.GET, "", errors.New("invalid key")
|
||||||
|
}
|
||||||
|
if strings.Contains(strings.ToUpper(s[0]), "INTERNAL") && external {
|
||||||
|
return tools.GET, "", errors.New("external ask for internal key")
|
||||||
|
}
|
||||||
|
meth, err := utils.ExtractMethod(s[0], false)
|
||||||
|
if err != nil {
|
||||||
|
return meth, "", err
|
||||||
|
}
|
||||||
|
p := strings.ReplaceAll(strings.ToUpper(s[1]), "_", "/")
|
||||||
|
return meth, p, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h HydraClaims) DecodeSignature(host string, signature string, publicKey string) (bool, error) {
|
||||||
|
hashed := sha256.Sum256([]byte(host))
|
||||||
|
spkiBlock, _ := pem.Decode([]byte(publicKey))
|
||||||
|
if spkiBlock == nil {
|
||||||
|
return false, errors.New("failed to decode public key PEM")
|
||||||
|
}
|
||||||
|
err := VerifyDefault(hashed[:], spkiBlock.Bytes, signature)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h HydraClaims) encodeSignature(host string) (string, error) {
|
||||||
|
hashed := sha256.Sum256([]byte(host))
|
||||||
|
content, err := os.ReadFile(conf.GetConfig().PrivateKeyPath)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
privateKey := string(content)
|
||||||
|
spkiBlock, _ := pem.Decode([]byte(privateKey))
|
||||||
|
if spkiBlock == nil {
|
||||||
|
return "", errors.New("failed to decode private key PEM")
|
||||||
|
}
|
||||||
|
return SignDefault(hashed[:], spkiBlock.Bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h HydraClaims) clearBlank(path []string) []string {
|
||||||
|
newPath := []string{}
|
||||||
|
for _, p := range path {
|
||||||
|
if p != "" {
|
||||||
|
newPath = append(newPath, p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newPath
|
||||||
|
}
|
||||||
|
|
||||||
|
// DecodeClaimsInToken verifies permissions from claims in a standard JWT (via introspection)
|
||||||
|
func (h HydraClaims) DecodeClaimsInToken(host string, method string, forward string, sessionClaims Claims, publicKey string, external bool) (bool, error) {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
idTokenClaims := sessionClaims.Session.IDToken
|
||||||
|
|
||||||
|
// Signature verification: skip if signature is empty (internal requests)
|
||||||
|
if sig, ok := idTokenClaims["signature"].(string); ok && sig != "" {
|
||||||
|
if ok, err := h.DecodeSignature(host, sig, publicKey); !ok {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
claims := sessionClaims.Session.AccessToken
|
||||||
|
if claims == nil {
|
||||||
|
return false, errors.New("no access_token claims found")
|
||||||
|
}
|
||||||
|
|
||||||
|
path := strings.ReplaceAll(forward, "http://"+host, "")
|
||||||
|
splittedPath := h.clearBlank(strings.Split(path, "/"))
|
||||||
|
|
||||||
|
for m, p := range claims {
|
||||||
|
pStr, ok := p.(string)
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
match := true
|
||||||
|
splittedP := h.clearBlank(strings.Split(pStr, "/"))
|
||||||
|
if len(splittedP) != len(splittedPath) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for i, v := range splittedP {
|
||||||
|
if strings.Contains(v, ":") { // is a param
|
||||||
|
continue
|
||||||
|
} else if v != splittedPath[i] {
|
||||||
|
match = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if match {
|
||||||
|
meth, _, err := h.decodeKey(m, external)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
perm := perms_connectors.Permission{
|
||||||
|
Relation: "permits" + strings.ToUpper(meth.String()),
|
||||||
|
Object: pStr,
|
||||||
|
}
|
||||||
|
return perms_connectors.GetPermissionConnector("").CheckPermission(perm, nil, true), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.Error().Msg("No permission found for " + method + " " + forward)
|
||||||
|
return false, errors.New("no permission found")
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuildConsentSession builds the session payload for Hydra consent accept.
|
||||||
|
// Claims are injected into the Hydra JWT — not appended to the token as before.
|
||||||
|
func (h HydraClaims) BuildConsentSession(clientID string, userId string, p *peer.Peer) Claims {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
c := Claims{}
|
||||||
|
perms, err := perms_connectors.KetoConnector{}.GetPermissionByUser(userId, true)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to get permissions for user " + userId + ": " + err.Error())
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Session.AccessToken = make(map[string]interface{})
|
||||||
|
c.Session.IDToken = make(map[string]interface{})
|
||||||
|
|
||||||
|
for _, perm := range perms {
|
||||||
|
key, err := h.generateKey(strings.ReplaceAll(perm.Relation, "permits", ""), perm.Subject)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
c.Session.AccessToken[key] = perm.Subject
|
||||||
|
}
|
||||||
|
|
||||||
|
sign, err := h.encodeSignature(p.APIUrl)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to encode signature: " + err.Error())
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Session.IDToken["username"] = userId
|
||||||
|
c.Session.IDToken["peer_id"] = p.UUID
|
||||||
|
c.Session.IDToken["client_id"] = clientID
|
||||||
|
|
||||||
|
groups, err := perms_connectors.KetoConnector{}.GetGroupByUser(userId)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to get groups for user " + userId + ": " + err.Error())
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
c.Session.IDToken["groups"] = groups
|
||||||
|
c.Session.IDToken["signature"] = sign
|
||||||
|
return c
|
||||||
|
}
|
||||||
19
infrastructure/infrastructure.go
Normal file
19
infrastructure/infrastructure.go
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package infrastructure
|
||||||
|
|
||||||
|
import (
|
||||||
|
auth_connectors "oc-auth/infrastructure/auth_connector"
|
||||||
|
"oc-auth/infrastructure/claims"
|
||||||
|
"oc-auth/infrastructure/perms_connectors"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetAuthConnector() auth_connectors.AuthConnector {
|
||||||
|
return auth_connectors.GetAuthConnector()
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetPermissionConnector(client string) perms_connectors.PermConnector {
|
||||||
|
return perms_connectors.GetPermissionConnector(client)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetClaims() claims.ClaimService {
|
||||||
|
return claims.GetClaims()
|
||||||
|
}
|
||||||
418
infrastructure/perms_connectors/keto_connector.go
Normal file
418
infrastructure/perms_connectors/keto_connector.go
Normal file
@@ -0,0 +1,418 @@
|
|||||||
|
package perms_connectors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"oc-auth/conf"
|
||||||
|
"oc-auth/infrastructure/utils"
|
||||||
|
|
||||||
|
oclib "cloud.o-forge.io/core/oc-lib"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
|
)
|
||||||
|
|
||||||
|
type KetoConnector struct {
|
||||||
|
Client string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) SetClient(client string) {
|
||||||
|
k.Client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) namespace() string {
|
||||||
|
return "open-cloud"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) scope() string {
|
||||||
|
return "oc-auth-realm"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f KetoConnector) permToQuery(perm Permission, permDependancies *Permission) string {
|
||||||
|
n := "?namespace=" + f.namespace()
|
||||||
|
if perm.Object != "" {
|
||||||
|
n += "&object=" + perm.Object
|
||||||
|
}
|
||||||
|
if perm.Subject != "" {
|
||||||
|
n += "&subject_id=" + perm.Subject
|
||||||
|
}
|
||||||
|
if perm.Relation != "" {
|
||||||
|
n += "&relation=" + perm.Relation
|
||||||
|
}
|
||||||
|
if permDependancies != nil {
|
||||||
|
n += "&subject_set.namespace=" + perm.Namespace()
|
||||||
|
if permDependancies.Object != "" {
|
||||||
|
n += "&subject_set.object=" + permDependancies.Object
|
||||||
|
}
|
||||||
|
if permDependancies.Subject != "" {
|
||||||
|
n += "&subject_set.subject_id=" + permDependancies.Subject
|
||||||
|
}
|
||||||
|
if permDependancies.Relation != "" {
|
||||||
|
n += "&subject_set.relation=" + permDependancies.Relation
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) Status() tools.State {
|
||||||
|
caller := tools.NewHTTPCaller(map[tools.DataType]map[tools.METHOD]string{})
|
||||||
|
var responseBody map[string]interface{}
|
||||||
|
host := conf.GetConfig().PermissionConnectorReadHost
|
||||||
|
if conf.GetConfig().Local {
|
||||||
|
host = "localhost"
|
||||||
|
}
|
||||||
|
port := fmt.Sprintf("%v", conf.GetConfig().PermissionConnectorPort)
|
||||||
|
resp, err := caller.CallGet("http://"+host+":"+port, "/health/ready")
|
||||||
|
if err != nil {
|
||||||
|
return tools.DEAD
|
||||||
|
}
|
||||||
|
err = json.Unmarshal(resp, &responseBody)
|
||||||
|
if err != nil || responseBody["status"] != "ok" {
|
||||||
|
return tools.DEAD
|
||||||
|
}
|
||||||
|
return tools.ALIVE
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) CheckPermission(perm Permission, permDependancies *Permission, internal bool) bool {
|
||||||
|
if (perm.Object == k.scope() || perm.Subject == k.scope()) && !internal {
|
||||||
|
log := oclib.GetLogger()
|
||||||
|
log.Error().Msg("Permission denied : Ask illegal permission")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
perms, err := k.GetPermission(perm.Object, perm.Relation)
|
||||||
|
if err != nil {
|
||||||
|
log := oclib.GetLogger()
|
||||||
|
log.Error().Msg("CheckPermission " + err.Error())
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return len(perms) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) deletes(object string, relation string, subject string, relation2 string) (string, int, error) {
|
||||||
|
k.deleteRelationShip(object, relation, subject, nil)
|
||||||
|
_, code, err := k.deleteRelationShip(subject, relation2, k.scope(), nil)
|
||||||
|
if err != nil {
|
||||||
|
return "", code, err
|
||||||
|
}
|
||||||
|
return subject, 200, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) DeleteRole(roleID string) (string, int, error) {
|
||||||
|
return k.deletes("", "member", roleID, "is")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) DeleteGroup(groupID string) (string, int, error) {
|
||||||
|
return k.deletes("", "groups", groupID, "groupin")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) DeletePermission(permID string, relation string, internal bool) (string, int, error) {
|
||||||
|
meth, err := utils.ExtractMethod(relation, internal)
|
||||||
|
if err != nil {
|
||||||
|
for _, method := range []tools.METHOD{tools.GET, tools.PUT, tools.POST, tools.DELETE} {
|
||||||
|
k.DeletePermission("", method.String(), internal)
|
||||||
|
}
|
||||||
|
return "", 200, err
|
||||||
|
}
|
||||||
|
return k.deletes("", "groups", permID, "permits"+meth.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) CreateRole(roleID string) (string, int, error) {
|
||||||
|
return k.creates(roleID, "is", k.scope())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) CreateGroup(groupID string) (string, int, error) {
|
||||||
|
return k.creates(groupID, "groupin", k.scope())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) CreatePermission(permID string, relation string, internal bool) (string, int, error) {
|
||||||
|
meth, err := utils.ExtractMethod(relation, internal)
|
||||||
|
if err != nil {
|
||||||
|
return "", 422, err
|
||||||
|
}
|
||||||
|
k.BindPermission("admin", permID, "permits"+meth.String())
|
||||||
|
return k.creates(permID, "permits"+meth.String(), k.scope())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) creates(object string, relation string, subject string) (string, int, error) {
|
||||||
|
p, code, err := k.createRelationShip(object, relation, subject, nil)
|
||||||
|
if err != nil {
|
||||||
|
return "", code, err
|
||||||
|
}
|
||||||
|
return p.Object, 200, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) GetRole(roleID string) ([]string, error) {
|
||||||
|
return k.gets(roleID, "is", k.scope())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) GetGroup(groupID string) ([]string, error) {
|
||||||
|
return k.gets(groupID, "groupin", k.scope())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) GetRoleByUser(userID string) ([]string, error) {
|
||||||
|
return k.gets("", "member", userID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) GetGroupByUser(userID string) ([]string, error) {
|
||||||
|
return k.gets("", "groups", userID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) gets(object string, relation string, subject string) ([]string, error) {
|
||||||
|
arr := []string{}
|
||||||
|
objs, err := k.get(object, relation, subject)
|
||||||
|
if err != nil {
|
||||||
|
return arr, err
|
||||||
|
}
|
||||||
|
for _, obj := range objs {
|
||||||
|
arr = append(arr, obj.Object)
|
||||||
|
}
|
||||||
|
return arr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) GetPermission(permID string, relation string) ([]Permission, error) {
|
||||||
|
meth, err := utils.ExtractMethod(relation, true)
|
||||||
|
if err != nil {
|
||||||
|
p := []Permission{}
|
||||||
|
for _, method := range []tools.METHOD{tools.GET, tools.PUT, tools.POST, tools.DELETE,
|
||||||
|
tools.STRICT_INTERNAL_DELETE, tools.STRICT_INTERNAL_GET, tools.STRICT_INTERNAL_POST, tools.STRICT_INTERNAL_PUT} {
|
||||||
|
perms, err := k.get(permID, "permits"+method.String(), k.scope())
|
||||||
|
if err == nil && len(perms) > 0 {
|
||||||
|
p = append(p, perms...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return p, nil
|
||||||
|
}
|
||||||
|
return k.get(permID, "permits"+meth.String(), k.scope())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) GetPermissionByRole(roleID string) ([]Permission, error) {
|
||||||
|
p := []Permission{}
|
||||||
|
for _, method := range []tools.METHOD{tools.GET, tools.PUT, tools.POST, tools.DELETE,
|
||||||
|
tools.STRICT_INTERNAL_DELETE, tools.STRICT_INTERNAL_GET, tools.STRICT_INTERNAL_POST, tools.STRICT_INTERNAL_PUT} {
|
||||||
|
perms, err := k.get(roleID, "permits"+method.String(), "")
|
||||||
|
if err == nil && len(perms) > 0 {
|
||||||
|
p = append(p, perms...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return p, nil
|
||||||
|
}
|
||||||
|
func (k KetoConnector) GetPermissionByUser(userID string, internal bool) ([]Permission, error) {
|
||||||
|
roles, err := k.get("", "member", userID)
|
||||||
|
log := oclib.GetLogger()
|
||||||
|
log.Debug().Msgf("GetPermissionByUser roles for %s: %d roles, err=%v", userID, len(roles), err)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
p := []Permission{}
|
||||||
|
meths := []tools.METHOD{tools.GET, tools.PUT, tools.POST, tools.DELETE}
|
||||||
|
if internal {
|
||||||
|
meths = append(meths, []tools.METHOD{tools.STRICT_INTERNAL_DELETE, tools.STRICT_INTERNAL_GET, tools.STRICT_INTERNAL_POST, tools.STRICT_INTERNAL_PUT}...)
|
||||||
|
}
|
||||||
|
for _, role := range roles {
|
||||||
|
for _, method := range meths {
|
||||||
|
perms, err := k.get(role.Object, "permits"+method.String(), "")
|
||||||
|
if err == nil && len(perms) > 0 {
|
||||||
|
p = append(p, perms...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return p, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) get(object string, relation string, subject string) ([]Permission, error) {
|
||||||
|
t := []Permission{}
|
||||||
|
caller := tools.NewHTTPCaller(map[tools.DataType]map[tools.METHOD]string{})
|
||||||
|
host := conf.GetConfig().PermissionConnectorReadHost
|
||||||
|
if conf.GetConfig().Local {
|
||||||
|
host = "localhost"
|
||||||
|
}
|
||||||
|
port := fmt.Sprintf("%v", conf.GetConfig().PermissionConnectorPort)
|
||||||
|
resp, err := caller.CallGet("http://"+host+":"+port, "/relation-tuples"+k.permToQuery(
|
||||||
|
Permission{Object: object, Relation: relation, Subject: subject}, nil))
|
||||||
|
if err != nil {
|
||||||
|
return t, err
|
||||||
|
}
|
||||||
|
var data map[string]interface{}
|
||||||
|
err = json.Unmarshal(resp, &data)
|
||||||
|
if err != nil {
|
||||||
|
return t, err
|
||||||
|
}
|
||||||
|
if data["relation_tuples"] != nil {
|
||||||
|
for _, v := range data["relation_tuples"].([]interface{}) {
|
||||||
|
t = append(t, Permission{
|
||||||
|
Relation: v.(map[string]interface{})["relation"].(string),
|
||||||
|
Subject: v.(map[string]interface{})["subject_id"].(string),
|
||||||
|
Object: v.(map[string]interface{})["object"].(string),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return t, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) binds(object string, relation string, subject string) (string, int, error) {
|
||||||
|
_, code, err := k.createRelationShip(object, relation, subject, nil)
|
||||||
|
if err != nil {
|
||||||
|
return object, code, err
|
||||||
|
}
|
||||||
|
return object, 200, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) BindRole(userID string, roleID string) (string, int, error) {
|
||||||
|
log := oclib.GetLogger()
|
||||||
|
log.Debug().Msgf("BindRole: user=%s role=%s", userID, roleID)
|
||||||
|
return k.binds(userID, "member", roleID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) BindGroup(userID string, groupID string) (string, int, error) {
|
||||||
|
return k.binds(userID, "groups", groupID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) BindPermission(roleID string, permID string, relation string) (*Permission, int, error) {
|
||||||
|
perms, err := k.GetPermission(permID, relation)
|
||||||
|
if err != nil || len(perms) != 1 {
|
||||||
|
count := 0
|
||||||
|
for _, p := range perms {
|
||||||
|
if p.Relation == relation {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count == 0 {
|
||||||
|
return nil, 404, errors.New("Permission not found")
|
||||||
|
} else if count > 1 {
|
||||||
|
return nil, 409, errors.New("Multiple permission found")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_, code, err := k.createRelationShip(roleID, relation, permID, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, code, err
|
||||||
|
}
|
||||||
|
return &Permission{
|
||||||
|
Object: roleID,
|
||||||
|
Relation: relation,
|
||||||
|
Subject: permID,
|
||||||
|
}, 200, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) unbinds(subject string, relation string, object string) (string, int, error) {
|
||||||
|
_, code, err := k.deleteRelationShip(object, relation, subject, nil)
|
||||||
|
if err != nil {
|
||||||
|
return object, code, err
|
||||||
|
}
|
||||||
|
return object, 200, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) UnBindRole(userID string, roleID string) (string, int, error) {
|
||||||
|
return k.unbinds(userID, "member", roleID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) UnBindGroup(userID string, groupID string) (string, int, error) {
|
||||||
|
return k.unbinds(userID, "groups", groupID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) UnBindPermission(roleID string, permID string, relation string) (*Permission, int, error) {
|
||||||
|
meth, err := utils.ExtractMethod(relation, false)
|
||||||
|
if err != nil {
|
||||||
|
return nil, 422, err
|
||||||
|
}
|
||||||
|
perms, err := k.GetPermission(permID, meth.String())
|
||||||
|
if err != nil || len(perms) != 1 {
|
||||||
|
count := 0
|
||||||
|
for _, p := range perms {
|
||||||
|
if p.Relation == relation {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count == 0 {
|
||||||
|
return nil, 404, errors.New("Permission not found")
|
||||||
|
} else if count > 1 {
|
||||||
|
return nil, 409, errors.New("Multiple permission found")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_, code, err := k.deleteRelationShip(roleID, perms[0].Relation, permID, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, code, err
|
||||||
|
}
|
||||||
|
return &Permission{
|
||||||
|
Object: roleID,
|
||||||
|
Relation: perms[0].Relation,
|
||||||
|
Subject: permID,
|
||||||
|
}, 200, nil
|
||||||
|
}
|
||||||
|
func (k KetoConnector) createRelationShip(object string, relation string, subject string, subPerm *Permission) (*Permission, int, error) {
|
||||||
|
exist, err := k.get(object, relation, subject)
|
||||||
|
if err == nil && len(exist) > 0 {
|
||||||
|
return nil, 409, errors.New("Relation already exist")
|
||||||
|
}
|
||||||
|
caller := tools.NewHTTPCaller(map[tools.DataType]map[tools.METHOD]string{})
|
||||||
|
body := map[string]interface{}{"namespace": k.namespace(), "object": object, "relation": relation, "subject_id": subject}
|
||||||
|
|
||||||
|
if subPerm != nil {
|
||||||
|
s, code, err := k.createRelationShip(subPerm.Object, subPerm.Relation, subPerm.Subject, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, code, err
|
||||||
|
}
|
||||||
|
body["subject_set"] = map[string]interface{}{"namespace": k.namespace(), "object": s.Object, "relation": s.Relation, "subject_id": s.Subject}
|
||||||
|
}
|
||||||
|
host := conf.GetConfig().PermissionConnectorWriteHost
|
||||||
|
if conf.GetConfig().Local {
|
||||||
|
host = "localhost"
|
||||||
|
}
|
||||||
|
port := fmt.Sprintf("%v", conf.GetConfig().PermissionConnectorAdminPort)
|
||||||
|
b, err := caller.CallPut("http://"+host+":"+port, "/relation-tuples", body)
|
||||||
|
if err != nil {
|
||||||
|
log := oclib.GetLogger()
|
||||||
|
log.Error().Msg("createRelationShip" + err.Error())
|
||||||
|
return nil, 500, err
|
||||||
|
}
|
||||||
|
data := map[string]interface{}{}
|
||||||
|
err = json.Unmarshal(b, &data)
|
||||||
|
if err != nil {
|
||||||
|
log := oclib.GetLogger()
|
||||||
|
log.Error().Msgf("createRelationShip unmarshal error: %s, err=%v", string(b), err)
|
||||||
|
return nil, 500, err
|
||||||
|
}
|
||||||
|
perm := &Permission{
|
||||||
|
Object: data["object"].(string),
|
||||||
|
Relation: data["relation"].(string),
|
||||||
|
Subject: data["subject_id"].(string),
|
||||||
|
}
|
||||||
|
if data["subject_set"] != nil {
|
||||||
|
sub := data["subject_set"].(map[string]interface{})
|
||||||
|
perm.SubPermission = &Permission{
|
||||||
|
Object: sub["object"].(string),
|
||||||
|
Relation: sub["relation"].(string),
|
||||||
|
Subject: sub["subject_id"].(string),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return perm, 200, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k KetoConnector) deleteRelationShip(object string, relation string, subject string, subPerm *Permission) (*Permission, int, error) {
|
||||||
|
exist, err := k.get(object, relation, subject)
|
||||||
|
if err == nil && len(exist) == 0 {
|
||||||
|
return nil, 409, errors.New("Relation does not exist")
|
||||||
|
}
|
||||||
|
caller := tools.NewHTTPCaller(map[tools.DataType]map[tools.METHOD]string{})
|
||||||
|
n := k.permToQuery(Permission{Object: object, Relation: relation, Subject: subject}, subPerm)
|
||||||
|
host := conf.GetConfig().PermissionConnectorWriteHost
|
||||||
|
if conf.GetConfig().Local {
|
||||||
|
host = "localhost"
|
||||||
|
}
|
||||||
|
port := fmt.Sprintf("%v", conf.GetConfig().PermissionConnectorAdminPort)
|
||||||
|
b, err := caller.CallDelete("http://"+host+":"+port, "/relation-tuples"+n)
|
||||||
|
if err != nil {
|
||||||
|
log := oclib.GetLogger()
|
||||||
|
log.Error().Msg("deleteRelationShip " + err.Error())
|
||||||
|
return nil, 500, err
|
||||||
|
}
|
||||||
|
var data map[string]interface{}
|
||||||
|
err = json.Unmarshal(b, &data)
|
||||||
|
if err == nil && data["code"].(int) > 300 {
|
||||||
|
return nil, data["code"].(int), errors.New("Error while deleting relation")
|
||||||
|
}
|
||||||
|
return &Permission{
|
||||||
|
Object: object,
|
||||||
|
Relation: relation,
|
||||||
|
Subject: subject,
|
||||||
|
SubPermission: subPerm,
|
||||||
|
}, 200, nil
|
||||||
|
}
|
||||||
65
infrastructure/perms_connectors/perms_connector.go
Normal file
65
infrastructure/perms_connectors/perms_connector.go
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
package perms_connectors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"oc-auth/conf"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Permission struct {
|
||||||
|
Object string `json:"object,omitempty"`
|
||||||
|
Relation string `json:"relation,omitempty"`
|
||||||
|
Subject string `json:"subject,omitempty"`
|
||||||
|
SubPermission *Permission `json:"sub_perm,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p Permission) Namespace() string {
|
||||||
|
return "open-cloud"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k Permission) Scope() string {
|
||||||
|
return "oc-auth"
|
||||||
|
}
|
||||||
|
|
||||||
|
type PermConnector interface {
|
||||||
|
Status() tools.State
|
||||||
|
SetClient(scope string)
|
||||||
|
CheckPermission(perm Permission, permDependancies *Permission, internal bool) bool
|
||||||
|
BindRole(userID string, roleID string) (string, int, error)
|
||||||
|
BindGroup(userID string, groupID string) (string, int, error)
|
||||||
|
BindPermission(roleID string, permID string, relation string) (*Permission, int, error)
|
||||||
|
|
||||||
|
UnBindRole(userID string, roleID string) (string, int, error)
|
||||||
|
UnBindGroup(userID string, groupID string) (string, int, error)
|
||||||
|
UnBindPermission(roleID string, permID string, relation string) (*Permission, int, error)
|
||||||
|
|
||||||
|
CreateRole(roleID string) (string, int, error)
|
||||||
|
CreateGroup(groupID string) (string, int, error)
|
||||||
|
CreatePermission(permID string, relation string, internal bool) (string, int, error)
|
||||||
|
DeleteRole(roleID string) (string, int, error)
|
||||||
|
DeleteGroup(groupID string) (string, int, error)
|
||||||
|
DeletePermission(permID string, relation string, internal bool) (string, int, error)
|
||||||
|
|
||||||
|
GetRoleByUser(userID string) ([]string, error)
|
||||||
|
GetGroupByUser(userID string) ([]string, error)
|
||||||
|
GetPermissionByRole(roleID string) ([]Permission, error)
|
||||||
|
GetPermissionByUser(userID string, internal bool) ([]Permission, error)
|
||||||
|
|
||||||
|
GetRole(roleID string) ([]string, error)
|
||||||
|
GetGroup(groupID string) ([]string, error)
|
||||||
|
GetPermission(permID string, relation string) ([]Permission, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
var c = map[string]PermConnector{
|
||||||
|
"keto": KetoConnector{},
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetPermissionConnector(scope string) PermConnector {
|
||||||
|
for k := range c {
|
||||||
|
if strings.Contains(conf.GetConfig().PermissionConnectorReadHost, k) {
|
||||||
|
return c[k]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
21
infrastructure/utils/utils.go
Normal file
21
infrastructure/utils/utils.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ExtractMethod(relation string, internal bool) (tools.METHOD, error) {
|
||||||
|
meths := []tools.METHOD{tools.GET, tools.PUT, tools.POST, tools.DELETE}
|
||||||
|
if internal {
|
||||||
|
meths = append(meths, []tools.METHOD{tools.STRICT_INTERNAL_GET, tools.STRICT_INTERNAL_POST, tools.STRICT_INTERNAL_POST, tools.STRICT_INTERNAL_DELETE}...)
|
||||||
|
}
|
||||||
|
for _, method := range meths {
|
||||||
|
if (!internal && strings.Contains(strings.ToUpper(relation), strings.ToUpper(method.String()))) || (internal && strings.ToUpper(relation) == strings.ToUpper(method.String())) {
|
||||||
|
return method, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tools.GET, errors.New("method not found")
|
||||||
|
}
|
||||||
150
main.go
150
main.go
@@ -1,54 +1,128 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"oc-auth/conf"
|
"oc-auth/conf"
|
||||||
|
"oc-auth/infrastructure"
|
||||||
|
auth_connectors "oc-auth/infrastructure/auth_connector"
|
||||||
_ "oc-auth/routers"
|
_ "oc-auth/routers"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/beego/beego/logs"
|
oclib "cloud.o-forge.io/core/oc-lib"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
beego "github.com/beego/beego/v2/server/web"
|
beego "github.com/beego/beego/v2/server/web"
|
||||||
"github.com/goraz/onion"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultConfigFile = "/etc/oc/auth.json"
|
const appname = "oc-auth"
|
||||||
const localConfigFile = "./auth.json"
|
|
||||||
|
|
||||||
|
// @securityDefinitions.apikey Bearer
|
||||||
|
// @in header
|
||||||
|
// @name Authorization
|
||||||
|
// @description Type "Bearer" followed by a space and JWT token.
|
||||||
func main() {
|
func main() {
|
||||||
log := logs.NewLogger(10000)
|
oclib.InitAPI(appname)
|
||||||
log.SetLogger("console")
|
// Load the right config file
|
||||||
|
o := oclib.GetConfLoader(appname)
|
||||||
|
|
||||||
configFile := ""
|
conf.GetConfig().AdminRole = o.GetStringDefault("ADMIN_ROLE", "admin")
|
||||||
var o *onion.Onion
|
conf.GetConfig().PublicKeyPath = o.GetStringDefault("PUBLIC_KEY_PATH", "./pem/public.pem")
|
||||||
l3 := onion.NewEnvLayerPrefix("_", "OCAUTH_")
|
conf.GetConfig().PrivateKeyPath = o.GetStringDefault("PRIVATE_KEY_PATH", "./pem/private.pem")
|
||||||
l2, err := onion.NewFileLayer(defaultConfigFile, nil)
|
conf.GetConfig().ClientSecret = o.GetStringDefault("CLIENT_SECRET", "oc-auth-got-secret")
|
||||||
if err == nil {
|
conf.GetConfig().OAuth2ClientSecretName = o.GetStringDefault("OAUTH2_CLIENT_SECRET_NAME", "oc-oauth2-client-secret")
|
||||||
logs.Info("Config file found : " + defaultConfigFile)
|
conf.GetConfig().OAuth2ClientSecretNamespace = o.GetStringDefault("NAMESPACE", "default")
|
||||||
configFile = defaultConfigFile
|
conf.GetConfig().Auth = o.GetStringDefault("AUTH", "hydra")
|
||||||
}
|
conf.GetConfig().AuthConnectorHost = o.GetStringDefault("AUTH_CONNECTOR_HOST", "localhost")
|
||||||
l1, err := onion.NewFileLayer(localConfigFile, nil)
|
conf.GetConfig().AuthConnectPublicHost = o.GetStringDefault("AUTH_CONNECTOR_PUBLIC_HOST", "localhost")
|
||||||
if err == nil {
|
conf.GetConfig().AuthConnectorPort = o.GetIntDefault("AUTH_CONNECTOR_PORT", 4444)
|
||||||
logs.Info("Local config file found " + localConfigFile + ", overriding default file")
|
conf.GetConfig().AuthConnectorAdminPort = o.GetStringDefault("AUTH_CONNECTOR_ADMIN_PORT", "4445/admin")
|
||||||
configFile = localConfigFile
|
conf.GetConfig().PermissionConnectorWriteHost = o.GetStringDefault("PERMISSION_CONNECTOR_WRITE_HOST", "keto")
|
||||||
}
|
conf.GetConfig().PermissionConnectorReadHost = o.GetStringDefault("PERMISSION_CONNECTOR_READ_HOST", "keto")
|
||||||
if configFile == "" {
|
conf.GetConfig().PermissionConnectorPort = o.GetStringDefault("PERMISSION_CONNECTOR_PORT", "4466")
|
||||||
logs.Info("No config file found, using env")
|
conf.GetConfig().PermissionConnectorAdminPort = o.GetStringDefault("PERMISSION_CONNECTOR_ADMIN_PORT", "4467")
|
||||||
o = onion.New(l3)
|
conf.GetConfig().Local = o.GetBoolDefault("LOCAL", true)
|
||||||
} else if l1 == nil && l2 == nil {
|
|
||||||
o = onion.New(l1, l2, l3)
|
|
||||||
} else if l1 == nil {
|
|
||||||
o = onion.New(l2, l3)
|
|
||||||
} else if l2 == nil {
|
|
||||||
o = onion.New(l1, l3)
|
|
||||||
}
|
|
||||||
|
|
||||||
conf.GetConfig().NatsUrl = o.GetStringDefault("natsurl", "http://localhost:4080")
|
// config LDAP
|
||||||
conf.GetConfig().NatsLogin = o.GetStringDefault("natslogin", "admin")
|
conf.GetConfig().SourceMode = o.GetStringDefault("SOURCE_MODE", "ldap")
|
||||||
conf.GetConfig().NatsPassword = o.GetStringDefault("natspassword", "admin")
|
conf.GetConfig().LDAPEndpoints = o.GetStringDefault("LDAP_ENDPOINTS", "ldap:389")
|
||||||
conf.GetConfig().OidcUrl = o.GetStringDefault("oidcurl", "admin")
|
conf.GetConfig().LDAPBindDN = o.GetStringDefault("LDAP_BINDDN", "cn=admin,dc=example,dc=com")
|
||||||
|
conf.GetConfig().LDAPBindPW = o.GetStringDefault("LDAP_BINDPW", "password")
|
||||||
|
conf.GetConfig().LDAPBaseDN = o.GetStringDefault("LDAP_BASEDN", "dc=example,dc=com")
|
||||||
|
conf.GetConfig().LDAPUserBaseDN = o.GetStringDefault("LDAP_USER_BASEDN", "ou=users,dc=example,dc=com")
|
||||||
|
conf.GetConfig().LDAPRoleBaseDN = o.GetStringDefault("LDAP_ROLE_BASEDN", "ou=AppRoles,dc=example,dc=com")
|
||||||
|
go generateRole()
|
||||||
|
go discovery()
|
||||||
|
|
||||||
// Normal beego init
|
|
||||||
//if beego.BConfig.RunMode == "dev" {
|
|
||||||
beego.BConfig.WebConfig.DirectoryIndex = true
|
|
||||||
beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
|
|
||||||
//}
|
|
||||||
beego.Run()
|
beego.Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func generateRole() {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
logger.Error().Msgf("generateRole recovered from panic: %v", r)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
if conf.GetConfig().SourceMode == "ldap" {
|
||||||
|
for {
|
||||||
|
ldap := auth_connectors.New()
|
||||||
|
roles, err := ldap.GetRoles(context.Background())
|
||||||
|
if err == nil {
|
||||||
|
logger.Info().Msgf("Syncing %d LDAP role groups to Keto", len(roles))
|
||||||
|
for _, role := range roles {
|
||||||
|
for r, m := range role.Members {
|
||||||
|
infrastructure.GetPermissionConnector("").CreateRole(r)
|
||||||
|
for _, p := range m {
|
||||||
|
infrastructure.GetPermissionConnector("").BindRole(r, p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
logger.Error().Msg("Failed to get LDAP roles, retrying in 10s: " + err.Error())
|
||||||
|
time.Sleep(10 * time.Second)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func discovery() {
|
||||||
|
logger := oclib.GetLogger()
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
logger.Error().Msgf("discovery recovered from panic: %v", r)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
for {
|
||||||
|
api := tools.API{}
|
||||||
|
conn := infrastructure.GetPermissionConnector("")
|
||||||
|
logger.Info().Msg("Starting permission discovery")
|
||||||
|
_, _, err := conn.CreateRole(conf.GetConfig().AdminRole)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg("Failed to create admin role, retrying in 10s: " + err.Error())
|
||||||
|
time.Sleep(10 * time.Second)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
conn.BindRole(conf.GetConfig().AdminRole, "admin")
|
||||||
|
addPermissions := func(m tools.NATSResponse) {
|
||||||
|
var resp map[string][]interface{}
|
||||||
|
json.Unmarshal(m.Payload, &resp)
|
||||||
|
for k, v := range resp {
|
||||||
|
for _, p := range v {
|
||||||
|
conn.CreatePermission(k, p.(string), true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
api.ListenRouter(addPermissions)
|
||||||
|
b, _ := json.Marshal(map[string]interface{}{})
|
||||||
|
tools.NewNATSCaller().SetNATSPub(tools.DISCOVERY, tools.NATSResponse{
|
||||||
|
FromApp: "oc-auth",
|
||||||
|
Datatype: -1,
|
||||||
|
User: "root",
|
||||||
|
Method: tools.GET.EnumIndex(),
|
||||||
|
Payload: b,
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
// OpenId application
|
|
||||||
type Application struct {
|
|
||||||
ClientId string `json:"client_id,omitempty"`
|
|
||||||
ClientName string `json:"client_name,omitempty"`
|
|
||||||
ClientSecret string `json:"client_secret,omitempty"`
|
|
||||||
AccessToken string `json:"access_token,omitempty"`
|
|
||||||
CallbackUrl string `json:"callback_url,omitempty"`
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"oc-auth/conf"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
c := conf.GetConfig()
|
|
||||||
// configure storage
|
|
||||||
fmt.Println(c.NatsUrl)
|
|
||||||
}
|
|
||||||
51
pem/private.pem
Normal file
51
pem/private.pem
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIJKQIBAAKCAgEAw2pdG6wMtuLcP0+k1LFvIb0DQo/oHW2uNJaEJK74plXqp4zt
|
||||||
|
z2dRb+RQHFLeLuqk4i/zc3b4K3fKPXSlwnVPJCwzPrnyT8jYGOZVlWlETiV9xeJh
|
||||||
|
u6s/Bh6g1PWz75XjjwV50iv/CEiLNBT23f/3J44wrQzygqNQCiQSALdxWLAEl4l5
|
||||||
|
kHSa9oMyV70/Uql94/ayMARZsHgp9ZvqQKbkZPw6yzVMfCBxQozlNlo315OHevud
|
||||||
|
hnhpDRjN5I7zWmqYt6rbXJJC7Y3Izdvzn7QI88RqjSRST5I/7Kz3ndCqrOnI+OQU
|
||||||
|
E5NTREyQebphvQfTDTKlRPXkdyktdK2DH28Zj6ZF3yjQvN35Q4zhOzlq77dO5Ihh
|
||||||
|
opI7ct8dZH1T1nYkvdyCA/EVMtQsASmBOitH0Y0ACoXQK5Kb6nm/TcM/9ZSJUNiE
|
||||||
|
Muy5gBZ3YKE9oa4cpTpPXwcA+S/cU7HPNnQAsvD3iJi8GTW9uJs84pn4/WhpQqmX
|
||||||
|
d4rvhKWECCN3fHy01fUs/U0PaSj2jDY/kQVeXoikNMzPUjdZd9m816TIBh3v3aVX
|
||||||
|
CH/0iTHHAxctvDgMRb2fpvRJ/wwnYjFG9RpamVFDMvC9NffuYzWAA9IRIY4cqger
|
||||||
|
fHrVZ2HHiPTDDvDAIsvImXZc/h7mXN6m3RCQ4Qywy993wd9gUdgg/qnynHcCAwEA
|
||||||
|
AQKCAgBSRc29gMo5lXm1DgsPoURwp+tfcsb+3NajPVuVNjVpknKg6CyXTaBzw2QX
|
||||||
|
CKyShCe3MwkEa+pAIsb66MmA/XK8f/9zQUZLYPvaP994cEFZxV8WmSEcqhR2tx5v
|
||||||
|
iqKfFDQiWuPXIL7W9fPlkY3+GW4tMSg9M15GsgtYuab6tkD6XeERC8gqkW1MrB/d
|
||||||
|
4MdwPfvKpmqO3MYGDhFcXrBZV+qAudDnDSGOgPouUrOOFp28HVjE5nqDyt4vrWnB
|
||||||
|
+I1sW8TATybb6phS+4a3ZQtFCb9bIi7aDZi595ECTDBUOS4ibqs2XpA1TamY78ND
|
||||||
|
/Lx5oXmx7Mi4J+5wXN3Oad7ytQvFOdOttILNpAMFbLU5yKsxf+EDjCBcR5faNAtu
|
||||||
|
wAMH9TkzFpmhp5NBwQdAkCFnhyla363ljmlGAWPuG/D9bVZ0qtBf3NAF4hEJ/L4n
|
||||||
|
vYQFErd64tPasAgWPow2LLvqi3jT232aDgahj1lX1enHoR6TbQE4r3zy8DeA7i0C
|
||||||
|
hA8GFAvMsqIcee9Xi4yD8QFEH0PrJh6zP1PWKXR4AQVExnFGanz0s6O1GRqLPrIK
|
||||||
|
31NiRTwIVp0xbet9/GsJxWxqrTKPqd5yJvUGG3A4EL8e3RdWRM5vTHbNCVGi9LhS
|
||||||
|
3OIXV9/YOQJtWxzWUjFN3HpaNuWHVSR149GAYpTxeh+/ZGoAQQKCAQEA9RzG0LrB
|
||||||
|
/onSnzfAXD5IwGW/jSb4e8VLCZ/7W0CiD1ht23Q1pAR4bofSYXdx/rhVhRty+38q
|
||||||
|
GzugBPcejGeGYyKIViO1e8Psrd6dydYoaA9fX3YzcZ0onk9t+tYNxVhstolfIGgc
|
||||||
|
KW1qwDNrV1PP0N/oQU4QPxLmwcf/BSSl3sf53mVMzcnHkjCF5SgEN1rtIAOUZaM8
|
||||||
|
B4urSSMZMLpwmhXF9rAUPXWgLS+0fkrQzoaBS2ZfqEcFNs1ln8sTBeoXAz6kyZem
|
||||||
|
0To1oYhTeN+Tg11quWhJKiTMYmSGT3B7nVt25n0BypDktfaUU+LMY9/BewWwE6xx
|
||||||
|
iX97bldgv6y4uwKCAQEAzBh5IYa09uJTwrxY0IKVfkXRp2S+8fqhJ5qhEPykCF+4
|
||||||
|
JJBKPp7IA7rhcf5tw3NVpa/YE1h2H1P5Z4EQkzgETExVotBlOYYNmkBkd9etURGs
|
||||||
|
omAPHprnvT7q+dR/rc8/lQt3Xzvej4P4zSRbnzg/q2K0I1qs3vOwnZyO3GXk6eni
|
||||||
|
Q59k0y8zosKdde7m1YJ+KAj5MZc3PeHTfbLaLcfXnTSUX6xwnX+Js8kr2PVP+wSj
|
||||||
|
sExakP6ieNu/ZzFcYv6aiPgyXIWO/5pjwLt/GTqUPQcO9W76m0w24lWnYCx1iySw
|
||||||
|
alrl2irL2rnlXJin7q4FttHTWbeH90RVt3050m8ddQKCAQEAkgylgnXlZc+lim1j
|
||||||
|
1xLdspZt/qM76DP0tDV5RjRK3C3qt5qU47guMl4Hwz+y0v3vJzLl3mk1I6jxfkPp
|
||||||
|
FewRrTxEVF9OogJqImfFSSCsTuTqBS2fFZF5RGs7svyck/xOOq272sluDlk+BGwf
|
||||||
|
B5fO+jyQXWkwUQToLosGr3/YvdgWUKe3jd8vZTI4dgTUDk/Ffw/i+nS7LhvQ4fFh
|
||||||
|
7yEIOyfCH21ngf92g7YrLB1UMdr/a3gCg3hd6PuWFBKisSF8uNg4xE3yfjTbA/cB
|
||||||
|
FcLSWLHvB67V+aCXkAEp7metoGOBg3D1Akg3nxzf4OQAuXn4BV+sPOzBchZd669w
|
||||||
|
3IUERQKCAQBxPE7QjBWROKcyTx+TqC/bHE+i6SGLzftlpsQgUZuMzdaz6p5Wue/N
|
||||||
|
Kf11Kq2pmC73u2VN7nGzFfs1MwWIOLchweRtbeQLk1WutHVJjI8rgHvgpx0cZOOY
|
||||||
|
OvVR4VVpkKf9QJxdaTElPRpobviqkSG6LAw35VIubNQbzkXxAFOOeGZCEIh3JyQl
|
||||||
|
9IY6bW8DHOBzw+7GVdifa9DUV8v3RH5bSVXc8yaUK7Ox3TaHrCtQ4RUUdnh1I+Hu
|
||||||
|
3jUGwvs4LXx96/69GJjrNbSMtTpiO/8NEQJ6p7VBPnrg/pbbpC8fIR8EEySd88qg
|
||||||
|
sy0PP99EbKbc9POnPk2gofhQ0pinKWEVAoIBAQC0h8J3lGSG9Ki9QJvAOdMqnsSg
|
||||||
|
uoqjI0y6RmeR7LpYX1ASKNNImjG1hwLyZ8Qg5hCNjySEqBAGGd3MBNfIC6wzBDrV
|
||||||
|
zSJIrxjvu+2sfz1nUGdYWjQfhx3cT+yGqT6NEQupmstNukxiu2HDu76pi96AX2mk
|
||||||
|
TXYXlubIpfL50dWZ0wij0LivH6TPavvjbRZnXNVth1qlZOUtuBGyEwcXb4COtqRq
|
||||||
|
+nP8AEgzKxbMJFVy3PY5E5JyjB5d1ZPQ2OeYUVbfDEEYqzkorjByCcLdv7O1CHNq
|
||||||
|
VjUyJsd8F1tuCGPxbcbgyCeIqgDM1JxO4zTMSP+C82Ar7VXkr6Q8hAsCgHQ/
|
||||||
|
-----END RSA PRIVATE KEY-----
|
||||||
13
pem/public.pem
Normal file
13
pem/public.pem
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
|
MIICCgKCAgEAw2pdG6wMtuLcP0+k1LFvIb0DQo/oHW2uNJaEJK74plXqp4ztz2dR
|
||||||
|
b+RQHFLeLuqk4i/zc3b4K3fKPXSlwnVPJCwzPrnyT8jYGOZVlWlETiV9xeJhu6s/
|
||||||
|
Bh6g1PWz75XjjwV50iv/CEiLNBT23f/3J44wrQzygqNQCiQSALdxWLAEl4l5kHSa
|
||||||
|
9oMyV70/Uql94/ayMARZsHgp9ZvqQKbkZPw6yzVMfCBxQozlNlo315OHevudhnhp
|
||||||
|
DRjN5I7zWmqYt6rbXJJC7Y3Izdvzn7QI88RqjSRST5I/7Kz3ndCqrOnI+OQUE5NT
|
||||||
|
REyQebphvQfTDTKlRPXkdyktdK2DH28Zj6ZF3yjQvN35Q4zhOzlq77dO5IhhopI7
|
||||||
|
ct8dZH1T1nYkvdyCA/EVMtQsASmBOitH0Y0ACoXQK5Kb6nm/TcM/9ZSJUNiEMuy5
|
||||||
|
gBZ3YKE9oa4cpTpPXwcA+S/cU7HPNnQAsvD3iJi8GTW9uJs84pn4/WhpQqmXd4rv
|
||||||
|
hKWECCN3fHy01fUs/U0PaSj2jDY/kQVeXoikNMzPUjdZd9m816TIBh3v3aVXCH/0
|
||||||
|
iTHHAxctvDgMRb2fpvRJ/wwnYjFG9RpamVFDMvC9NffuYzWAA9IRIY4cqgerfHrV
|
||||||
|
Z2HHiPTDDvDAIsvImXZc/h7mXN6m3RCQ4Qywy993wd9gUdgg/qnynHcCAwEAAQ==
|
||||||
|
-----END RSA PUBLIC KEY-----
|
||||||
@@ -7,51 +7,285 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
||||||
beego.GlobalControllerRouter["oc-auth/controllers:AuthController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:AuthController"],
|
beego.GlobalControllerRouter["oc-auth/controllers:GroupController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:GroupController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "Post",
|
Method: "GetAll",
|
||||||
Router: `/`,
|
Router: `/`,
|
||||||
AllowHTTPMethods: []string{"post"},
|
|
||||||
MethodParams: param.Make(),
|
|
||||||
Filters: nil,
|
|
||||||
Params: nil})
|
|
||||||
|
|
||||||
beego.GlobalControllerRouter["oc-auth/controllers:AuthController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:AuthController"],
|
|
||||||
beego.ControllerComments{
|
|
||||||
Method: "Get",
|
|
||||||
Router: `/:authId`,
|
|
||||||
AllowHTTPMethods: []string{"get"},
|
AllowHTTPMethods: []string{"get"},
|
||||||
MethodParams: param.Make(),
|
MethodParams: param.Make(),
|
||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["oc-auth/controllers:AuthController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:AuthController"],
|
beego.GlobalControllerRouter["oc-auth/controllers:GroupController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:GroupController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Post",
|
||||||
|
Router: `/:id`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:GroupController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:GroupController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Get",
|
||||||
|
Router: `/:id`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:GroupController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:GroupController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "Delete",
|
Method: "Delete",
|
||||||
Router: `/:authId`,
|
Router: `/:id`,
|
||||||
AllowHTTPMethods: []string{"delete"},
|
AllowHTTPMethods: []string{"delete"},
|
||||||
MethodParams: param.Make(),
|
MethodParams: param.Make(),
|
||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["oc-auth/controllers:AuthController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:AuthController"],
|
beego.GlobalControllerRouter["oc-auth/controllers:GroupController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:GroupController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "Find",
|
Method: "Bind",
|
||||||
Router: `/find/:query`,
|
Router: `/:user_id/:group_id`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:GroupController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:GroupController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "UnBind",
|
||||||
|
Router: `/:user_id/:group_id`,
|
||||||
|
AllowHTTPMethods: []string{"delete"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:GroupController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:GroupController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Clear",
|
||||||
|
Router: `/clear`,
|
||||||
|
AllowHTTPMethods: []string{"delete"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:GroupController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:GroupController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetByUser",
|
||||||
|
Router: `/user/:id`,
|
||||||
AllowHTTPMethods: []string{"get"},
|
AllowHTTPMethods: []string{"get"},
|
||||||
MethodParams: param.Make(),
|
MethodParams: param.Make(),
|
||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["oc-auth/controllers:RegistrationController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:RegistrationController"],
|
beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Consent",
|
||||||
|
Router: `/consent`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "InternalAuthForward",
|
||||||
|
Router: `/forward`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Introspect",
|
||||||
|
Router: `/introspect`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetLogin",
|
||||||
|
Router: `/login`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Login",
|
||||||
|
Router: `/login`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetLogout",
|
||||||
|
Router: `/logout`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "LogOut",
|
||||||
|
Router: `/logout`,
|
||||||
|
AllowHTTPMethods: []string{"delete"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:OAuthController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Refresh",
|
||||||
|
Router: `/refresh`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:PermissionController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:PermissionController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetAll",
|
||||||
|
Router: `/`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:PermissionController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:PermissionController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Get",
|
||||||
|
Router: `/:id/:relation`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:PermissionController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:PermissionController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Bind",
|
||||||
|
Router: `/:permission_id/:role_id/:relation`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:PermissionController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:PermissionController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "UnBind",
|
||||||
|
Router: `/:permission_id/:role_id/:relation`,
|
||||||
|
AllowHTTPMethods: []string{"delete"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:PermissionController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:PermissionController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Clear",
|
||||||
|
Router: `/clear`,
|
||||||
|
AllowHTTPMethods: []string{"delete"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:PermissionController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:PermissionController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetByRole",
|
||||||
|
Router: `/role/:id`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:PermissionController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:PermissionController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetByUser",
|
||||||
|
Router: `/user/:id`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:RoleController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:RoleController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetAll",
|
||||||
|
Router: `/`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:RoleController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:RoleController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "Post",
|
Method: "Post",
|
||||||
Router: `/`,
|
Router: `/:id`,
|
||||||
AllowHTTPMethods: []string{"post"},
|
AllowHTTPMethods: []string{"post"},
|
||||||
MethodParams: param.Make(),
|
MethodParams: param.Make(),
|
||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:RoleController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:RoleController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Get",
|
||||||
|
Router: `/:id`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:RoleController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:RoleController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Delete",
|
||||||
|
Router: `/:id`,
|
||||||
|
AllowHTTPMethods: []string{"delete"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:RoleController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:RoleController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Bind",
|
||||||
|
Router: `/:user_id/:role_id`,
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:RoleController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:RoleController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "UnBind",
|
||||||
|
Router: `/:user_id/:role_id`,
|
||||||
|
AllowHTTPMethods: []string{"delete"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:RoleController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:RoleController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Clear",
|
||||||
|
Router: `/clear`,
|
||||||
|
AllowHTTPMethods: []string{"delete"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:RoleController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:RoleController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetByUser",
|
||||||
|
Router: `/user/:id`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["oc-auth/controllers:VersionController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:VersionController"],
|
beego.GlobalControllerRouter["oc-auth/controllers:VersionController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:VersionController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "GetAll",
|
Method: "GetAll",
|
||||||
@@ -61,4 +295,13 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["oc-auth/controllers:VersionController"] = append(beego.GlobalControllerRouter["oc-auth/controllers:VersionController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "Get",
|
||||||
|
Router: `/discovery`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
// @APIVersion 1.0.0
|
// @APIVersion 1.0.0
|
||||||
// @Title beego Test API
|
// @Title oc-auth
|
||||||
// @Description beego has a very cool tools to autogenerate documents for your API
|
// @Description OpenCloud authentication services
|
||||||
// @Contact astaxie@gmail.com
|
// @Contact admin@o-cloud.io
|
||||||
// @TermsOfServiceUrl http://beego.me/
|
// @TermsOfServiceUrl http://cloud.o-forge.io/
|
||||||
// @License Apache 2.0
|
// @License AGPL
|
||||||
// @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
// @LicenseUrl https://www.gnu.org/licenses/agpl-3.0.html
|
||||||
package routers
|
package routers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -14,15 +14,23 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
ns := beego.NewNamespace("/oc",
|
ns := beego.NewNamespace("/oc/",
|
||||||
beego.NSNamespace("/auth",
|
beego.NSInclude(
|
||||||
|
&controllers.OAuthController{},
|
||||||
|
),
|
||||||
|
beego.NSNamespace("/group",
|
||||||
beego.NSInclude(
|
beego.NSInclude(
|
||||||
&controllers.AuthController{},
|
&controllers.GroupController{},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
beego.NSNamespace("/registration",
|
beego.NSNamespace("/role",
|
||||||
beego.NSInclude(
|
beego.NSInclude(
|
||||||
&controllers.RegistrationController{},
|
&controllers.RoleController{},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
beego.NSNamespace("/permission",
|
||||||
|
beego.NSInclude(
|
||||||
|
&controllers.PermissionController{},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
beego.NSNamespace("/version",
|
beego.NSNamespace("/version",
|
||||||
@@ -31,6 +39,5 @@ func init() {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
beego.AddNamespace(ns)
|
beego.AddNamespace(ns)
|
||||||
}
|
}
|
||||||
|
|||||||
1023
swagger/swagger.json
1023
swagger/swagger.json
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,575 @@
|
|||||||
swagger: "2.0"
|
swagger: "2.0"
|
||||||
info:
|
info:
|
||||||
title: beego Test API
|
title: oc-auth
|
||||||
description: |
|
description: |
|
||||||
beego has a very cool tools to autogenerate documents for your API
|
OpenCloud authentication services
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
termsOfService: http://beego.me/
|
termsOfService: http://cloud.o-forge.io/
|
||||||
contact:
|
contact:
|
||||||
email: astaxie@gmail.com
|
email: admin@o-cloud.io
|
||||||
license:
|
license:
|
||||||
name: Apache 2.0
|
name: AGPL
|
||||||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
url: https://www.gnu.org/licenses/agpl-3.0.html
|
||||||
basePath: /oc
|
basePath: /oc/
|
||||||
paths:
|
paths:
|
||||||
|
/consent:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- oc-auth/controllersOAuthController
|
||||||
|
description: |-
|
||||||
|
Hydra redirects here with a consent_challenge. Auto-accepts consent with user permissions.
|
||||||
|
<br>
|
||||||
|
operationId: OAuthController.Consent
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: consent_challenge
|
||||||
|
description: The consent challenge from Hydra
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: ""
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/auth_connectors.Redirect'
|
||||||
|
"400":
|
||||||
|
description: missing consent_challenge
|
||||||
|
"500":
|
||||||
|
description: internal error
|
||||||
|
/forward:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- oc-auth/controllersOAuthController
|
||||||
|
description: |-
|
||||||
|
Forward auth for Traefik — validates JWT via Hydra introspection
|
||||||
|
<br>
|
||||||
|
operationId: OAuthController.AuthForward
|
||||||
|
parameters:
|
||||||
|
- in: header
|
||||||
|
name: Authorization
|
||||||
|
description: Bearer token
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{string}'
|
||||||
|
/group/:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- group
|
||||||
|
description: |-
|
||||||
|
find groups
|
||||||
|
<br>
|
||||||
|
operationId: GroupController.GetAll
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{group} string'
|
||||||
|
/group/{id}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- group
|
||||||
|
description: |-
|
||||||
|
find group by id
|
||||||
|
<br>
|
||||||
|
operationId: GroupController.Get
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
description: the id you want to get
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{group} string'
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- group
|
||||||
|
description: |-
|
||||||
|
create group
|
||||||
|
<br>
|
||||||
|
operationId: GroupController.Create
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
description: the id you want to get
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{auth} create success!'
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- group
|
||||||
|
description: |-
|
||||||
|
delete the group
|
||||||
|
<br>
|
||||||
|
operationId: GroupController.Delete
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
description: The id you want to delete
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{string} delete success!'
|
||||||
|
/group/{user_id}/{group_id}:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- group
|
||||||
|
description: |-
|
||||||
|
bind the group to user
|
||||||
|
<br>
|
||||||
|
operationId: GroupController.Bind
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: user_id
|
||||||
|
description: The user_id you want to bind
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- in: path
|
||||||
|
name: group_id
|
||||||
|
description: The group_id you want to bind
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{string} bind success!'
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- group
|
||||||
|
description: |-
|
||||||
|
unbind the group to user
|
||||||
|
<br>
|
||||||
|
operationId: GroupController.UnBind
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: user_id
|
||||||
|
description: The group_id you want to unbind
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- in: path
|
||||||
|
name: group_id
|
||||||
|
description: The user_id you want to unbind
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{string} bind success!'
|
||||||
|
/group/clear:
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- group
|
||||||
|
description: |-
|
||||||
|
clear the group
|
||||||
|
<br>
|
||||||
|
operationId: GroupController.Clear
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{string} delete success!'
|
||||||
|
/group/user/{id}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- group
|
||||||
|
description: |-
|
||||||
|
find group by user id
|
||||||
|
<br>
|
||||||
|
operationId: GroupController.GetByUser
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
description: the id you want to get
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{auth} string'
|
||||||
|
/introspect:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- oc-auth/controllersOAuthController
|
||||||
|
description: |-
|
||||||
|
Introspect a token — respects Hydra's response
|
||||||
|
<br>
|
||||||
|
operationId: OAuthController.Introspect
|
||||||
|
parameters:
|
||||||
|
- in: header
|
||||||
|
name: Authorization
|
||||||
|
description: Bearer token
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: ""
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/auth_connectors.IntrospectResult'
|
||||||
|
/login:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- oc-auth/controllersOAuthController
|
||||||
|
description: |-
|
||||||
|
Hydra redirects here with a login_challenge. Returns challenge info or auto-accepts if session exists.
|
||||||
|
<br>
|
||||||
|
operationId: OAuthController.GetLogin
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: login_challenge
|
||||||
|
description: The login challenge from Hydra
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: ""
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/auth_connectors.LoginChallenge'
|
||||||
|
"400":
|
||||||
|
description: missing login_challenge
|
||||||
|
"500":
|
||||||
|
description: internal error
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- oc-auth/controllersOAuthController
|
||||||
|
description: |-
|
||||||
|
Authenticate user via LDAP and accept Hydra login challenge
|
||||||
|
<br>
|
||||||
|
operationId: OAuthController.PostLogin
|
||||||
|
parameters:
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: Login credentials and challenge
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/auth_connectors.LoginRequest'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: ""
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/auth_connectors.Redirect'
|
||||||
|
"401":
|
||||||
|
description: invalid credentials
|
||||||
|
"500":
|
||||||
|
description: internal error
|
||||||
|
/logout:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- oc-auth/controllersOAuthController
|
||||||
|
description: |-
|
||||||
|
Hydra redirects here with a logout_challenge. Accepts the challenge and returns a redirect URL.
|
||||||
|
<br>
|
||||||
|
operationId: OAuthController.GetLogout
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: logout_challenge
|
||||||
|
description: The logout challenge from Hydra
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: ""
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/auth_connectors.Redirect'
|
||||||
|
"400":
|
||||||
|
description: missing logout_challenge
|
||||||
|
"500":
|
||||||
|
description: internal error
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- oc-auth/controllersOAuthController
|
||||||
|
description: |-
|
||||||
|
Revoke an OAuth2 token
|
||||||
|
<br>
|
||||||
|
operationId: OAuthController.Logout
|
||||||
|
parameters:
|
||||||
|
- in: header
|
||||||
|
name: Authorization
|
||||||
|
description: Bearer token
|
||||||
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: client_id
|
||||||
|
description: The client_id
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: ""
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/auth_connectors.Token'
|
||||||
|
/permission/:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- permission
|
||||||
|
description: |-
|
||||||
|
find permissions
|
||||||
|
<br>
|
||||||
|
operationId: PermissionController.GetAll
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{permission} string'
|
||||||
|
/permission/{id}/{relation}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- permission
|
||||||
|
description: |-
|
||||||
|
find auth by permission
|
||||||
|
<br>
|
||||||
|
operationId: PermissionController.Get
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
description: the permission you want to get
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{auth} models.auth'
|
||||||
|
/permission/{permission_id}/{role_id}/{relation}:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- permission
|
||||||
|
description: |-
|
||||||
|
bind the permission to role
|
||||||
|
<br>
|
||||||
|
operationId: PermissionController.Bind
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: role_id
|
||||||
|
description: The role_id you want to bind
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- in: path
|
||||||
|
name: method
|
||||||
|
description: The method you want to relate role & permission
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- in: path
|
||||||
|
name: permission_id
|
||||||
|
description: The permission_id you want to bind
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{string} bind success!'
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- permission
|
||||||
|
description: |-
|
||||||
|
unbind the permission to role
|
||||||
|
<br>
|
||||||
|
operationId: PermissionController.UnBind
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: role_id
|
||||||
|
description: The role_id you want to unbind
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- in: path
|
||||||
|
name: relation
|
||||||
|
description: The method you want to unrelate role & permission
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- in: path
|
||||||
|
name: permission_id
|
||||||
|
description: The permission_id you want to unbind
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{string} bind success!'
|
||||||
|
/permission/clear:
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- permission
|
||||||
|
description: |-
|
||||||
|
clear the permission
|
||||||
|
<br>
|
||||||
|
operationId: PermissionController.Clear
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{string} delete success!'
|
||||||
|
/permission/role/{id}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- permission
|
||||||
|
description: |-
|
||||||
|
find permission by role id
|
||||||
|
<br>
|
||||||
|
operationId: PermissionController.GetByRole
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
description: the id you want to get
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{auth} string'
|
||||||
|
/permission/user/{id}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- permission
|
||||||
|
description: |-
|
||||||
|
find permission by user id
|
||||||
|
<br>
|
||||||
|
operationId: PermissionController.GetByUser
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
description: the id you want to get
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{auth} string'
|
||||||
|
/refresh:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- oc-auth/controllersOAuthController
|
||||||
|
description: |-
|
||||||
|
Exchange a refresh_token for a new token set
|
||||||
|
<br>
|
||||||
|
operationId: OAuthController.Refresh
|
||||||
|
parameters:
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: refresh_token and client_id
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: ""
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/auth_connectors.TokenResponse'
|
||||||
|
"401":
|
||||||
|
description: invalid refresh token
|
||||||
|
/role/:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- role
|
||||||
|
description: |-
|
||||||
|
find roles
|
||||||
|
<br>
|
||||||
|
operationId: RoleController.GetAll
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{role} string'
|
||||||
|
/role/{id}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- role
|
||||||
|
description: |-
|
||||||
|
find role by id
|
||||||
|
<br>
|
||||||
|
operationId: RoleController.Get
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
description: the id you want to get
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{role} string'
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- role
|
||||||
|
description: |-
|
||||||
|
create role
|
||||||
|
<br>
|
||||||
|
operationId: RoleController.Create
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
description: the id you want to get
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{auth} create success!'
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- role
|
||||||
|
description: |-
|
||||||
|
delete the role
|
||||||
|
<br>
|
||||||
|
operationId: RoleController.Delete
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
description: The id you want to delete
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{string} delete success!'
|
||||||
|
/role/{user_id}/{role_id}:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- role
|
||||||
|
description: |-
|
||||||
|
bind the role to user
|
||||||
|
<br>
|
||||||
|
operationId: RoleController.Bind
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: user_id
|
||||||
|
description: The user_id you want to bind
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- in: path
|
||||||
|
name: role_id
|
||||||
|
description: The role_id you want to bind
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{string} bind success!'
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- role
|
||||||
|
description: |-
|
||||||
|
unbind the role to user
|
||||||
|
<br>
|
||||||
|
operationId: RoleController.UnBind
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: role_id
|
||||||
|
description: The role_id you want to unbind
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- in: path
|
||||||
|
name: user_id
|
||||||
|
description: The user_id you want to unbind
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{string} bind success!'
|
||||||
|
/role/clear:
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- role
|
||||||
|
description: |-
|
||||||
|
clear the role
|
||||||
|
<br>
|
||||||
|
operationId: RoleController.Clear
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{string} delete success!'
|
||||||
|
/role/user/{id}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- role
|
||||||
|
description: |-
|
||||||
|
find role by user id
|
||||||
|
<br>
|
||||||
|
operationId: RoleController.GetByUser
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: id
|
||||||
|
description: the id you want to get
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{auth} string'
|
||||||
/version/:
|
/version/:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
@@ -23,90 +581,125 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: ""
|
description: ""
|
||||||
/auth/:
|
/version/discovery:
|
||||||
post:
|
|
||||||
tags:
|
|
||||||
- auth
|
|
||||||
description: |-
|
|
||||||
create auths
|
|
||||||
<br>
|
|
||||||
operationId: AuthController.Create
|
|
||||||
parameters:
|
|
||||||
- in: body
|
|
||||||
name: body
|
|
||||||
description: The auth content
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/definitions/models.auth'
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: '{string} models.auth.Id'
|
|
||||||
"403":
|
|
||||||
description: body is empty
|
|
||||||
/auth/{authId}:
|
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- auth
|
- version
|
||||||
description: |-
|
description: |-
|
||||||
find auth by authid
|
get version
|
||||||
<br>
|
<br>
|
||||||
operationId: AuthController.Get
|
operationId: VersionController.Get
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
name: authId
|
|
||||||
description: the authid you want to get
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: '{auth} models.auth'
|
|
||||||
"403":
|
|
||||||
description: :authId is empty
|
|
||||||
delete:
|
|
||||||
tags:
|
|
||||||
- auth
|
|
||||||
description: |-
|
|
||||||
delete the auth
|
|
||||||
<br>
|
|
||||||
operationId: AuthController.Delete
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
name: authId
|
|
||||||
description: The authId you want to delete
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: '{string} delete success!'
|
|
||||||
"403":
|
|
||||||
description: authId is empty
|
|
||||||
/auth/find/{query}:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- auth
|
|
||||||
description: |-
|
|
||||||
find auths with query
|
|
||||||
<br>
|
|
||||||
operationId: AuthController.Find
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
name: query
|
|
||||||
description: the keywords you need
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: '{auths} []models.auth'
|
|
||||||
"403":
|
|
||||||
description: ""
|
description: ""
|
||||||
definitions:
|
definitions:
|
||||||
models.auth:
|
2111.0xc0004ce750.false:
|
||||||
title: auth
|
title: "false"
|
||||||
|
type: object
|
||||||
|
3850.0xc0004ce930.false:
|
||||||
|
title: "false"
|
||||||
|
type: object
|
||||||
|
auth_connectors.IntrospectResult:
|
||||||
|
title: IntrospectResult
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
active:
|
||||||
|
type: boolean
|
||||||
|
client_id:
|
||||||
|
type: string
|
||||||
|
exp:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
ext:
|
||||||
|
$ref: '#/definitions/3850.0xc0004ce930.false'
|
||||||
|
scope:
|
||||||
|
type: string
|
||||||
|
sub:
|
||||||
|
type: string
|
||||||
|
token_type:
|
||||||
|
type: string
|
||||||
|
auth_connectors.LoginChallenge:
|
||||||
|
title: LoginChallenge
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
challenge:
|
||||||
|
type: string
|
||||||
|
client:
|
||||||
|
$ref: '#/definitions/2111.0xc0004ce750.false'
|
||||||
|
request_url:
|
||||||
|
type: string
|
||||||
|
session_id:
|
||||||
|
type: string
|
||||||
|
skip:
|
||||||
|
type: boolean
|
||||||
|
subject:
|
||||||
|
type: string
|
||||||
|
auth_connectors.LoginRequest:
|
||||||
|
title: LoginRequest
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
login_challenge:
|
||||||
|
type: string
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
auth_connectors.Redirect:
|
||||||
|
title: Redirect
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
redirect_to:
|
||||||
|
type: string
|
||||||
|
auth_connectors.Token:
|
||||||
|
title: Token
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
access_token:
|
||||||
|
type: string
|
||||||
|
active:
|
||||||
|
type: boolean
|
||||||
|
expires_in:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
id_token:
|
||||||
|
type: string
|
||||||
|
refresh_token:
|
||||||
|
type: string
|
||||||
|
scope:
|
||||||
|
type: string
|
||||||
|
token_type:
|
||||||
|
type: string
|
||||||
|
auth_connectors.TokenResponse:
|
||||||
|
title: TokenResponse
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
access_token:
|
||||||
|
type: string
|
||||||
|
expires_in:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
id_token:
|
||||||
|
type: string
|
||||||
|
refresh_token:
|
||||||
|
type: string
|
||||||
|
scope:
|
||||||
|
type: string
|
||||||
|
token_type:
|
||||||
|
type: string
|
||||||
|
object:
|
||||||
|
title: object
|
||||||
type: object
|
type: object
|
||||||
tags:
|
tags:
|
||||||
- name: auth
|
- name: oc-auth/controllersOAuthController
|
||||||
|
description: |
|
||||||
|
OAuthController handles OAuth2 login/consent provider endpoints
|
||||||
|
- name: group
|
||||||
|
description: |
|
||||||
|
Operations about auth
|
||||||
|
- name: role
|
||||||
|
description: |
|
||||||
|
Operations about auth
|
||||||
|
- name: permission
|
||||||
description: |
|
description: |
|
||||||
Operations about auth
|
Operations about auth
|
||||||
- name: version
|
- name: version
|
||||||
|
|||||||
Reference in New Issue
Block a user