exceptionfactory commented on a change in pull request #5262:
URL: https://github.com/apache/nifi/pull/5262#discussion_r681267476



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/jwt/provider/StandardBearerTokenProvider.java
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.web.security.jwt.provider;
+
+import com.nimbusds.jose.JOSEException;
+import com.nimbusds.jose.JWSAlgorithm;
+import com.nimbusds.jose.JWSHeader;
+import com.nimbusds.jose.JWSObject;
+import com.nimbusds.jose.JWSSigner;
+import com.nimbusds.jose.Payload;
+import com.nimbusds.jwt.JWTClaimsSet;
+import org.apache.nifi.web.security.jwt.jws.JwsSignerContainer;
+import org.apache.nifi.web.security.jwt.jws.JwsSignerProvider;
+import org.apache.nifi.web.security.token.LoginAuthenticationToken;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.util.Date;
+import java.util.Objects;
+import java.util.UUID;
+
+/**
+ * Standard Bearer Token Provider supports returning serialized and signed 
JSON Web Tokens
+ */
+public class StandardBearerTokenProvider implements BearerTokenProvider {
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(StandardBearerTokenProvider.class);
+
+    private static final String URL_ENCODED_CHARACTER_SET = 
StandardCharsets.UTF_8.name();
+
+    private final JwsSignerProvider jwsSignerProvider;
+
+    public StandardBearerTokenProvider(final JwsSignerProvider 
jwsSignerProvider) {
+        this.jwsSignerProvider = jwsSignerProvider;
+    }
+
+    /**
+     * Get Signed JSON Web Token using Login Authentication Token
+     *
+     * @param loginAuthenticationToken Login Authentication Token
+     * @return Serialized Signed JSON Web Token
+     */
+    @Override
+    public String getBearerToken(final LoginAuthenticationToken 
loginAuthenticationToken) {
+        Objects.requireNonNull(loginAuthenticationToken, 
"LoginAuthenticationToken required");

Review comment:
       That is correct, calling classes authenticate provided credentials and 
return a `LoginAuthenticationToken` on success.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to