Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F21841001
basic_auth_decoder_plug.ex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
649 B
Referenced Files
None
Subscribers
None
basic_auth_decoder_plug.ex
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Plugs.BasicAuthDecoderPlug
do
import
Plug.Conn
def
init
(
options
)
do
options
end
def
call
(
conn
,
_opts
)
do
with
[
"Basic "
<>
header
]
<-
get_req_header
(
conn
,
"authorization"
),
{
:ok
,
userinfo
}
<-
Base
.
decode64
(
header
),
[
username
,
password
]
<-
String
.
split
(
userinfo
,
":"
,
parts
:
2
)
do
conn
|>
assign
(
:auth_credentials
,
%{
username
:
username
,
password
:
password
})
else
_
->
conn
end
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Sat, Dec 27, 11:49 PM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
751324
Default Alt Text
basic_auth_decoder_plug.ex (649 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment