GNUnet  0.17.6
oidc_helper.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2010-2015 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
27 #ifndef JWT_H
28 #define JWT_H
29 
30 #define JWT_ALG "alg"
31 #define JWT_TYP "typ"
32 #define JWT_TYP_VALUE "jwt"
33 
34 #define JWT_ALG_VALUE_HMAC "HS512"
35 #define JWT_ALG_VALUE_RSA "RS256"
36 
37 #define SERVER_ADDRESS "http://localhost:7776"
38 
40 {
45 
50 };
51 
63 char *
65  const struct GNUNET_IDENTITY_PublicKey *sub_key,
66  const struct GNUNET_RECLAIM_AttributeList *attrs,
67  const struct
68  GNUNET_RECLAIM_PresentationList *presentations,
69  const struct GNUNET_TIME_Relative *expiration_time,
70  const char *nonce,
71  const json_t *secret_rsa_key);
72 
84 char*
86  const struct GNUNET_IDENTITY_PublicKey *sub_key,
87  const struct GNUNET_RECLAIM_AttributeList *attrs,
88  const struct
89  GNUNET_RECLAIM_PresentationList *presentations,
90  const struct GNUNET_TIME_Relative *expiration_time,
91  const char *nonce,
92  const char *secret_key);
93 
107 char*
109  const struct GNUNET_RECLAIM_Ticket *ticket,
110  const struct GNUNET_RECLAIM_AttributeList *attrs,
111  const struct
112  GNUNET_RECLAIM_PresentationList *presentations,
113  const char *nonce,
114  const char *code_challenge);
115 
130 int
131 OIDC_parse_authz_code (const struct GNUNET_IDENTITY_PublicKey *ecdsa_pub,
132  const char *code,
133  const char *code_verifier,
135  struct GNUNET_RECLAIM_AttributeList **attrs,
136  struct GNUNET_RECLAIM_PresentationList **presentations,
137  char **nonce,
139 
149 void
150 OIDC_build_token_response (const char *access_token,
151  const char *id_token,
152  const struct GNUNET_TIME_Relative *expiration_time,
153  char **token_response);
154 
158 char*
160 
164 int
165 OIDC_access_token_parse (const char*token,
166  struct GNUNET_RECLAIM_Ticket **ticket);
167 
168 
178 OIDC_check_scopes_for_claim_request (const char *scopes,
179  const char *attr);
180 
181 
190 char *
192  const struct GNUNET_RECLAIM_AttributeList *attrs,
193  const struct
194  GNUNET_RECLAIM_PresentationList *presentations);
195 
196 #endif
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
GNUNET_GenericReturnValue
Named constants for return values.
Definition: gnunet_common.h:96
char * OIDC_generate_id_token_hmac(const struct GNUNET_IDENTITY_PublicKey *aud_key, const struct GNUNET_IDENTITY_PublicKey *sub_key, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_RECLAIM_PresentationList *presentations, const struct GNUNET_TIME_Relative *expiration_time, const char *nonce, const char *secret_key)
Create a JWT using HMAC (HS256) from attributes.
Definition: oidc_helper.c:501
char * OIDC_generate_userinfo(const struct GNUNET_IDENTITY_PublicKey *sub_key, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_RECLAIM_PresentationList *presentations)
Generate userinfo JSON as string.
Definition: oidc_helper.c:346
char * OIDC_access_token_new(const struct GNUNET_RECLAIM_Ticket *ticket)
Generate a new access token.
Definition: oidc_helper.c:930
char * OIDC_build_authz_code(const struct GNUNET_IDENTITY_PrivateKey *issuer, const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_RECLAIM_PresentationList *presentations, const char *nonce, const char *code_challenge)
Builds an OIDC authorization code including a reclaim ticket and nonce.
Definition: oidc_helper.c:595
OIDC_VerificationOptions
Definition: oidc_helper.h:40
@ OIDC_VERIFICATION_NO_CODE_VERIFIER
Do not check code verifier even if expected.
Definition: oidc_helper.h:49
@ OIDC_VERIFICATION_DEFAULT
Strict verification.
Definition: oidc_helper.h:44
enum GNUNET_GenericReturnValue OIDC_check_scopes_for_claim_request(const char *scopes, const char *attr)
Checks if a claim is implicitly requested through standard scope(s)
Definition: oidc_helper.c:972
void OIDC_build_token_response(const char *access_token, const char *id_token, const struct GNUNET_TIME_Relative *expiration_time, char **token_response)
Build a token response for a token request TODO: Maybe we should add the scope here?
Definition: oidc_helper.c:902
int OIDC_parse_authz_code(const struct GNUNET_IDENTITY_PublicKey *ecdsa_pub, const char *code, const char *code_verifier, struct GNUNET_RECLAIM_Ticket *ticket, struct GNUNET_RECLAIM_AttributeList **attrs, struct GNUNET_RECLAIM_PresentationList **presentations, char **nonce, enum OIDC_VerificationOptions opts)
Parse reclaim ticket and nonce from authorization code.
Definition: oidc_helper.c:781
int OIDC_access_token_parse(const char *token, struct GNUNET_RECLAIM_Ticket **ticket)
Parse an access token.
Definition: oidc_helper.c:945
char * OIDC_generate_id_token_rsa(const struct GNUNET_IDENTITY_PublicKey *aud_key, const struct GNUNET_IDENTITY_PublicKey *sub_key, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_RECLAIM_PresentationList *presentations, const struct GNUNET_TIME_Relative *expiration_time, const char *nonce, const json_t *secret_rsa_key)
Create a JWT using RSA256 from attributes.
Definition: oidc_helper.c:439
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
A list of GNUNET_RECLAIM_Attribute structures.
A list of GNUNET_RECLAIM_Presentation structures.
The authorization ticket.
Time for relative time used by GNUnet, in microseconds.