Skip to content

Commit

Permalink
feat: Added Gitlab Authentication method (cesanta#319)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksei Apaseev <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
  • Loading branch information
3 people authored Oct 4, 2021
1 parent 5101eed commit 9aa1b21
Show file tree
Hide file tree
Showing 8 changed files with 582 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Supported authentication methods:
* Static list of users
* Google Sign-In (incl. Google for Work / GApps for domain) (documented [here](https://github.com/cesanta/docker_auth/blob/master/examples/reference.yml))
* [Github Sign-In](docs/auth-methods.md#github)
* Gitlab Sign-In
* LDAP bind ([demo](https://github.com/kwk/docker-registry-setup))
* MongoDB user collection
* MySQL/MariaDB, PostgreSQL, SQLite database table
Expand Down
42 changes: 42 additions & 0 deletions auth_server/authn/data/gitlab_auth.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!doctype html>

<html>
<head>
<meta charset="utf-8">
<title>Docker Registry Authentication</title>
<style>
body {
color: #000;
background: #fff;
font-family: sans-serif;
padding: 4em 4em;
}
a { color: #000; }
#panel p { text-align:center; }
#login-with-gitlab code {
font-size: 1.4em;
}
#revoke-access {
color: #666;
font-size: 0.8em;
text-decoration: none;
}
#revoke-access:hover {
text-decoration: underline;
}
</style>
</head>

<body>
<div id="panel">
<p>
<a id="gitlab-icon" href="{{.GitlabWebUri}}/oauth/authorize?client_id={{.ClientId}}&redirect_uri={{.RedirectUri}}&response_type=code&state=&scope=read_user">
<img src="https://about.gitlab.com/images/press/logo/png/gitlab-logo-gray-stacked-rgb.png" width="155px" height="155px"></img>
</a>
</p>
<p>
<a id="revoke-access" href="{{.GitlabWebUri}}/-/profile/applications">Revoke access</a>
</p>
</div>
</body>
</html>
51 changes: 51 additions & 0 deletions auth_server/authn/data/gitlab_auth_result.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!doctype html>

<html>
<head>
<meta charset="utf-8">
<title>Docker Registry Authentication</title>
<style>
body {
color: #000;
background: #fff;
font-family: sans-serif;
padding: 4em 4em;
}
hr {
border: none;
border-top: 1px solid #ccc;
}
.message code {
font-size: 1.4em;
background: #ccc;
border-radius: 0.5em;
padding: 0.25em 0.5em;
margin: 0 0.25em 0 0.25em;
}
.command {
font-size: 2em;
line-height: 2em;
color: #222;
background: #fafafa;
padding: 1em 1em 1.2em 1em;
margin: 1em 0;
border-radius: 0.5em;
text-shadow: 0px 1px 0px #fff;
}
.command span {
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
</style>
</head>
<body>
<p class="message">
You are successfully authenticated to the Docker Registry.
Use the following username and password to login into the registry:
</p>
<hr>
<pre class="command"><span>$ </span>docker login -u {{.Username}} -p {{.Password}} {{if .RegistryUrl}}{{.RegistryUrl}}{{else}}docker.example.com{{end}}</pre>
</body>
</html>
Loading

0 comments on commit 9aa1b21

Please sign in to comment.