mirror of
https://github.com/davidallendj/opaal.git
synced 2025-12-20 03:27:02 -07:00
Added ability to get authorization code
This commit is contained in:
parent
bfcbca9cf1
commit
5bae300daa
9 changed files with 174 additions and 48 deletions
Binary file not shown.
|
|
@ -1,7 +1,10 @@
|
|||
package oidc
|
||||
|
||||
import "fmt"
|
||||
|
||||
type OpenIDConnectProvider struct {
|
||||
Host string
|
||||
Port int
|
||||
AuthorizeEndpoint string
|
||||
TokenEndpoint string
|
||||
ConfigEndpoint string
|
||||
|
|
@ -9,17 +12,24 @@ type OpenIDConnectProvider struct {
|
|||
|
||||
func NewOIDCProvider() *OpenIDConnectProvider {
|
||||
return &OpenIDConnectProvider{
|
||||
Host: "https://gitlab.newmexicoconsortium.org",
|
||||
Host: "127.0.0.1",
|
||||
Port: 80,
|
||||
AuthorizeEndpoint: "/oauth/authorize",
|
||||
TokenEndpoint: "/oauth/token",
|
||||
}
|
||||
}
|
||||
|
||||
func (oidc *OpenIDConnectProvider) GetAuthorizeUrl() string {
|
||||
if oidc.Port != 80 {
|
||||
return fmt.Sprintf("%s:%d", oidc.Host, oidc.Port) + oidc.AuthorizeEndpoint
|
||||
}
|
||||
return oidc.Host + oidc.AuthorizeEndpoint
|
||||
}
|
||||
|
||||
func (oidc *OpenIDConnectProvider) GetTokenUrl() string {
|
||||
if oidc.Port != 80 {
|
||||
return fmt.Sprintf("%s:%d", oidc.Host, oidc.Port) + oidc.TokenEndpoint
|
||||
}
|
||||
return oidc.Host + oidc.TokenEndpoint
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue